|
|
Hello, This was working fine until today. I have a form with a subform. When I enter in the information on the form, I have an "Add" button that moves the information to the subform. Today when I tried to use it, it is giving me a runtime error 2105 and highlights my docmd line. Please help me figure out what the problem is.
Private Sub cmdAdd_Click()
Me.subForm.SetFocus DoCmd.GoToRecord , , acNewRec Form_frmInventoryTransaction.TransactionDate = Me.txtDate Form_frmInventoryTransaction.Received = Me.txtReceived Form_frmInventoryTransaction.AdjustedIN = Me.txtAdjustedIN Form_frmInventoryTransaction.AdjustedOUT = Me.txtAdjustedOUT Form_frmInventoryTransaction.Comment = Me.memoComment Me.Refresh
Me.txtReceived = 0 Me.txtAdjustedIN = 0 Me.txtAdjustedOUT = 0 Me.memoComment = "" Me.txtReceived.SetFocus
If Me.RecordsetClone.RecordCount > 1 Then DoCmd.GoToRecord , , acNext End If End Sub
Thank you
|
|
The error is telling you it can't go to a New Record. There are a few things that could cause this.
For example, Access attempts to save before navigating to another record, so if there is something, like a required field that hasn't been filled out, that causes the save to fail, then your DoCmd.GoToRecord will fail.
Another possibility is that somehow the subforms Allow Additions property got set to No (False).
-- _________
Sean Bailey
"Cmenkedi" wrote:
[Quoted Text] > Hello, > This was working fine until today. > I have a form with a subform. When I enter in the information on the form, I > have an "Add" button that moves the information to the subform. Today when I > tried to use it, it is giving me a runtime error 2105 and highlights my docmd > line. Please help me figure out what the problem is. > > Private Sub cmdAdd_Click() > > Me.subForm.SetFocus > DoCmd.GoToRecord , , acNewRec > Form_frmInventoryTransaction.TransactionDate = Me.txtDate > Form_frmInventoryTransaction.Received = Me.txtReceived > Form_frmInventoryTransaction.AdjustedIN = Me.txtAdjustedIN > Form_frmInventoryTransaction.AdjustedOUT = Me.txtAdjustedOUT > Form_frmInventoryTransaction.Comment = Me.memoComment > Me.Refresh > > > > Me.txtReceived = 0 > Me.txtAdjustedIN = 0 > Me.txtAdjustedOUT = 0 > Me.memoComment = "" > Me.txtReceived.SetFocus > > If Me.RecordsetClone.RecordCount > 1 Then > DoCmd.GoToRecord , , acNext > End If > End Sub > > Thank you
|
|
I have checked and the Allow Additions is set to yes. What has me puzzled is that it worked fine up until yesterday. Now it doesn't matter if my main form is filtered or not.
"Beetle" wrote:
[Quoted Text] > The error is telling you it can't go to a New Record. There are a few things > that could cause this. > > For example, Access attempts to save before navigating to another record, > so if there is something, like a required field that hasn't been filled out, > that causes the save to fail, then your DoCmd.GoToRecord will fail. > > Another possibility is that somehow the subforms Allow Additions > property got set to No (False). > > -- > _________ > > Sean Bailey > > > "Cmenkedi" wrote: > > > Hello, > > This was working fine until today. > > I have a form with a subform. When I enter in the information on the form, I > > have an "Add" button that moves the information to the subform. Today when I > > tried to use it, it is giving me a runtime error 2105 and highlights my docmd > > line. Please help me figure out what the problem is. > > > > Private Sub cmdAdd_Click() > > > > Me.subForm.SetFocus > > DoCmd.GoToRecord , , acNewRec > > Form_frmInventoryTransaction.TransactionDate = Me.txtDate > > Form_frmInventoryTransaction.Received = Me.txtReceived > > Form_frmInventoryTransaction.AdjustedIN = Me.txtAdjustedIN > > Form_frmInventoryTransaction.AdjustedOUT = Me.txtAdjustedOUT > > Form_frmInventoryTransaction.Comment = Me.memoComment > > Me.Refresh > > > > > > > > Me.txtReceived = 0 > > Me.txtAdjustedIN = 0 > > Me.txtAdjustedOUT = 0 > > Me.memoComment = "" > > Me.txtReceived.SetFocus > > > > If Me.RecordsetClone.RecordCount > 1 Then > > DoCmd.GoToRecord , , acNext > > End If > > End Sub > > > > Thank you
|
|
Can you move to a new record in the sub form using the standard navigation buttons, and not your command button?
If you have a recent backup, is that still working normally? -- _________
Sean Bailey
"Cmenkedi" wrote:
[Quoted Text] > I have checked and the Allow Additions is set to yes. What has me puzzled is > that it worked fine up until yesterday. Now it doesn't matter if my main form > is filtered or not. > > > "Beetle" wrote: > > > The error is telling you it can't go to a New Record. There are a few things > > that could cause this. > > > > For example, Access attempts to save before navigating to another record, > > so if there is something, like a required field that hasn't been filled out, > > that causes the save to fail, then your DoCmd.GoToRecord will fail. > > > > Another possibility is that somehow the subforms Allow Additions > > property got set to No (False). > > > > -- > > _________ > > > > Sean Bailey > > > > > > "Cmenkedi" wrote: > > > > > Hello, > > > This was working fine until today. > > > I have a form with a subform. When I enter in the information on the form, I > > > have an "Add" button that moves the information to the subform. Today when I > > > tried to use it, it is giving me a runtime error 2105 and highlights my docmd > > > line. Please help me figure out what the problem is. > > > > > > Private Sub cmdAdd_Click() > > > > > > Me.subForm.SetFocus > > > DoCmd.GoToRecord , , acNewRec > > > Form_frmInventoryTransaction.TransactionDate = Me.txtDate > > > Form_frmInventoryTransaction.Received = Me.txtReceived > > > Form_frmInventoryTransaction.AdjustedIN = Me.txtAdjustedIN > > > Form_frmInventoryTransaction.AdjustedOUT = Me.txtAdjustedOUT > > > Form_frmInventoryTransaction.Comment = Me.memoComment > > > Me.Refresh > > > > > > > > > > > > Me.txtReceived = 0 > > > Me.txtAdjustedIN = 0 > > > Me.txtAdjustedOUT = 0 > > > Me.memoComment = "" > > > Me.txtReceived.SetFocus > > > > > > If Me.RecordsetClone.RecordCount > 1 Then > > > DoCmd.GoToRecord , , acNext > > > End If > > > End Sub > > > > > > Thank you
|
|
|