• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1129
  • Last Modified:

"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.SetFocus
 End If
Exit_btnAddNew_Click:
     Exit Sub
Err_btnAddNew_Click:
     MsgBox Err.Description
    Resume Exit_btnAddNew_Click
    End Sub
0
billcute
Asked:
billcute
  • 4
  • 2
  • 2
1 Solution
 
clarkscottCommented:
You may have fields that are REQUIRED.   Try this, open the recordset in datasheet mode (directly into the table) and enter the exact data you would if from the form.  Access will immediately tell you why you can't add record.

Scott C.
0
 
billcuteAuthor Commented:
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
0
 
puppydogbuddyCommented:
Hi Bill,
Try changing this:
  If Me.NewRecord Then
    DoCmd.GoToRecord , "frmSewer", acNewRec
    Call QuestionBox
    Me.txtAppEntryDate.SetFocus
 End If

   
to this:
    DoCmd.GoToRecord , "frmSewer", acNewRec
    Call QuestionBox
    Me.txtAppEntryDate.SetFocus

how can you go to new record if the current record is a new record?

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
billcuteAuthor Commented:
puppydogbuddy,
When I rem out this line code...it made no difference

If Me.NewRecord Then
0
 
clarkscottCommented:
You have too many inner joins in your (form) query.... Access cannot determine what record (table) you are updating/adding.

When you create a recordset with too many relationships - and the recordset includes all the fields of all the tables.... Access will not be able to update.


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.

Scott C
0
 
puppydogbuddyCommented:
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.
0
 
billcuteAuthor Commented:
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
0
 
billcuteAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now