billcute
asked on
"You cant go to the Specified Record" Error
After filling out all the three Pages of my form, user clicked the AddNew button in order to advance to a new record...user started to receive...
"You cant go to the specified record" and unable to save the current record.
..debug highlighted from the code below
DoCmd.GoToRecord , "frmSewer", acNewRec
Any suggestion in correcting this problem will be appreciated.
' ************************** *********
Private Sub btnAddNew_Click()
On Error GoTo Err_btnAddNew_Click
If Not MandatoryFields Then ' <---Check for Mandatory Fields
Exit Sub
End If
Call SaveCurrentControlValues ' For Autofill Routine
' ************************** *****
If Me.AllowAdditions = False Then Me.AllowAdditions = True
Me.Filter = ""
Me.FilterOn = False
If Me.NewRecord Then
DoCmd.GoToRecord , "frmSewer", acNewRec
Call QuestionBox
Me.txtAppEntryDate.SetFocu s
End If
Exit_btnAddNew_Click:
Exit Sub
Err_btnAddNew_Click:
MsgBox Err.Description
Resume Exit_btnAddNew_Click
End Sub
"You cant go to the specified record" and unable to save the current record.
..debug highlighted from the code below
DoCmd.GoToRecord , "frmSewer", acNewRec
Any suggestion in correcting this problem will be appreciated.
' **************************
Private Sub btnAddNew_Click()
On Error GoTo Err_btnAddNew_Click
If Not MandatoryFields Then ' <---Check for Mandatory Fields
Exit Sub
End If
Call SaveCurrentControlValues ' For Autofill Routine
' **************************
If Me.AllowAdditions = False Then Me.AllowAdditions = True
Me.Filter = ""
Me.FilterOn = False
If Me.NewRecord Then
DoCmd.GoToRecord , "frmSewer", acNewRec
Call QuestionBox
Me.txtAppEntryDate.SetFocu
End If
Exit_btnAddNew_Click:
Exit Sub
Err_btnAddNew_Click:
MsgBox Err.Description
Resume Exit_btnAddNew_Click
End Sub
ASKER
Scott,
I added the data directly to the table as suggested and there was no problem adding them. I suppect that the error is with this line code ofmy btnAddNew:
DoCmd.GoToRecord , "frmSewer", acNewRec
Regards,
Bill
I added the data directly to the table as suggested and there was no problem adding them. I suppect that the error is with this line code ofmy btnAddNew:
DoCmd.GoToRecord , "frmSewer", acNewRec
Regards,
Bill
Hi Bill,
Try changing this:
If Me.NewRecord Then
DoCmd.GoToRecord , "frmSewer", acNewRec
Call QuestionBox
Me.txtAppEntryDate.SetFocu s
End If
to this:
DoCmd.GoToRecord , "frmSewer", acNewRec
Call QuestionBox
Me.txtAppEntryDate.SetFocu s
how can you go to new record if the current record is a new record?
Try changing this:
If Me.NewRecord Then
DoCmd.GoToRecord , "frmSewer", acNewRec
Call QuestionBox
Me.txtAppEntryDate.SetFocu
End If
to this:
DoCmd.GoToRecord , "frmSewer", acNewRec
Call QuestionBox
Me.txtAppEntryDate.SetFocu
how can you go to new record if the current record is a new record?
ASKER
puppydogbuddy,
When I rem out this line code...it made no difference
If Me.NewRecord Then
When I rem out this line code...it made no difference
If Me.NewRecord Then
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
move this:
Call SaveCurrentControlValues ' For Autofill Routine
To here:
DoCmd.GoToRecord , "frmSewer", acNewRec
Call SaveCurrentControlValues ' For Autofill Routine
can't call autofill until you new record has focus.
Call SaveCurrentControlValues ' For Autofill Routine
To here:
DoCmd.GoToRecord , "frmSewer", acNewRec
Call SaveCurrentControlValues ' For Autofill Routine
can't call autofill until you new record has focus.
ASKER
Scott,
I think I have an idea of what you are talking about. Yes, I recently joined several tables in the control source of my main form - I am sure this may be responsible for the problem. Thanks
If you have more time I can explore this your other suggestion..
"..You may need to add a SAVE button that, in code, you add/update records per specific tables using the text (or combo selctions) in your form"
Regards
Bill
I think I have an idea of what you are talking about. Yes, I recently joined several tables in the control source of my main form - I am sure this may be responsible for the problem. Thanks
If you have more time I can explore this your other suggestion..
"..You may need to add a SAVE button that, in code, you add/update records per specific tables using the text (or combo selctions) in your form"
Regards
Bill
ASKER
puppydogbuddy ,
I think Scott is right...I checked it out...and found the "joins" to be cause of the problem...I will need to post a new question later in order to explore other alternatives around the joins.
Regards
Bill
I think Scott is right...I checked it out...and found the "joins" to be cause of the problem...I will need to post a new question later in order to explore other alternatives around the joins.
Regards
Bill
Scott C.