473,503 Members | 9,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Runtime Error 2105 You Can't Go to the specified record

64 New Member
Hi all,

My data entry form wont allow me to add a new record. It brings up an error on the DoCmd.GoToRecord , , acNewRec line. The form is set to Allow Additons and Data Entry to Yes. I thought that it may have been not saving the record properly but after inserting the save record command it has saved to the table as expected. validAddForm is a function that holds my validation rules and is tested in the Before_Update of the form. If true, then the record has passed validation.

I can't work out why this "You can't Go to the specified record" error is happening! All help is most appreciated as always!

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAddFile_Click()
  2.  
  3. Dim intResponse As Integer
  4.  
  5.     If validAddForm = True Then
  6.         DoCmd.RunCommand acCmdSaveRecord
  7.         DoCmd.GoToRecord , , acNewRec
  8.     Else
  9.         MsgBox "This record is incomplete." & vbCrLf & "You have not included:" & vbCrLf & strInvalid, vbExclamation + vbOKOnly, "Adding Record: Incomplete"
  10.     End If
  11. End Sub
Edit: When in form view, if I switch to datasheet view and then back into form view, the record can then be added. The acCmdSaveRecord saves the record correctly but then the error pops up saying that it can't go to the next record!
Jan 23 '15 #1
1 5493
twinnyfo
3,653 Recognized Expert Moderator Specialist
David,

I would suggest adding a validation to the AfterUpdate events of your text boxes. Whenever a user updates any value, run the validation. If the validation passed, then enable the cmdAddFile button. If it fails validation, then disable the button. I can't explain "why" but sometimes Access gets confused during such operations (I've done similar things with identical results). However, this work-around is actually better coding, as you are validating data as you go along and only allowing users to move to the next step once all data is valid.

Hope this hepps!
Feb 25 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
5144
by: swathky | last post by:
I've tried mutiple things but no go -- (sorry this is so long) I'm collecting a 5 digit number in an input box function and all works fine until a number is passed that doesn't exist in the...
2
21931
by: Polly | last post by:
I'm trying to write the results of a query, a name, ID number, and date out to a notepad .txt file to print on a "legacy" printer. I get the output from the first 2 "write" lines over the...
0
5044
by: Jamey | last post by:
I perused old posts for an answer to this for at least an hour, and I've found a work-around, but no definitive answer. Synopsis of the problem: On NotInList or ctl.Requery commands where a...
1
4061
by: samotek | last post by:
Can i avoid the appearance of the Run time error 2105? I have a function that performs well,but at the end the Run time error 2105 appears :" You cant go to the specified record" However...
7
2213
by: David01 | last post by:
When I run some code behind a button i get a runtime error message. The strange thing is that the code run perfectly some months ago. Can some one help me ! Some additional information: The company...
1
3094
by: Gilberto | last post by:
Hello, in several forms i have a NEXT, PREVIOUS and SAVE command buttons which were working perfectly...no errors showing...nothing!!! i had to convert my DB to 2003 so i could create the .mde. I did...
3
3613
rsmccli
by: rsmccli | last post by:
Using AC2002 Hello. I am working with an existing DB that has "Add New" command buttons on two forms. When I, an Admin, click the buttons, they work properly, and a new, blank form is created,...
11
14585
by: scottbouley | last post by:
I'm new at adding VBA to Access 2007 and could really use some help. I have two forms used to gather data to go into a datasheet subform. The following code on the second of the two forms populates...
0
2007
by: dpsathas | last post by:
Hi everybody I have a database created in access 2007. In one form I created a button with the following VBA code (on click event) DoCmd.GoToRecord , , acNewRec A_S = Nz(DMax(“A_S”, “Table1”))...
0
1571
by: simulationguy | last post by:
I have a database the runs fine in Access 2003 but this routine crashes with error 2105 "You can't go to the specified record" in Access 2007 on the last line !itemNumber.SetFocus Any idea why...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.