?
Solved

"You cant go to the Specified Record" Error

Posted on 2006-05-05
8
Medium Priority
?
1,124 Views
Last Modified: 2009-07-29
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
Comment
Question by:billcute
  • 4
  • 2
  • 2
8 Comments
 
LVL 20

Expert Comment

by:clarkscott
ID: 16613494
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
 
LVL 4

Author Comment

by:billcute
ID: 16613554
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
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 16613675
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 4

Author Comment

by:billcute
ID: 16613697
puppydogbuddy,
When I rem out this line code...it made no difference

If Me.NewRecord Then
0
 
LVL 20

Accepted Solution

by:
clarkscott earned 2000 total points
ID: 16613743
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
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 16613772
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
 
LVL 4

Author Comment

by:billcute
ID: 16613848
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
 
LVL 4

Author Comment

by:billcute
ID: 16613860
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question