473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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 5477
twinnyfo
3,653 Expert Mod 2GB
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
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
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
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
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
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
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
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
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.