473,657 Members | 2,458 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.GoToRecor d , , 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 5519
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
5154
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 database. I can't figure out where/how to check that the number exists before I get the error code 2105. Here's my function to get the number that I run when a command button is clicked to open the frmEditLoans form: Public Function...
2
21960
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 course of the recordset, but get the 3021 error for the third line, on the last record in the recordset. (I did not include the input boxes code for the dates range because
0
5063
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 record has been deleted (or appended via SQL), Access returns Runtime error 2118 when you get to the Requery command which reads: 'You must save the current field before you run the Requery action.'
1
4071
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 when i click "End" on the window, i go to the desired place and my function will be perfect if i can
7
2218
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 I work for upgraded the citrix enviremont. Here is the code: Private Sub knptoevoegen_Click() On Error GoTo err_knptoevoegen_click Dim filid As Variant Dim beursid As Variant Dim fout As Integer
1
3111
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 the conversion and now my forms give me a run-time error 2105 or 2499 every time i reach the first/last record and try to go one more previous/next record. Im new with access and dont want any fancy error handler i just need to AVOID the error and...
3
3620
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, ready for data entry. When one of my users from the "Update Data" workgroup clicks the button, they get an "Error 2105: You can't go to the specified record" error, and no new row is created. Each of these are just supposed to add a new row in...
11
14603
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 the subform: Private Sub OK_Click() If ( > ) Then MsgBox "Sales Quantity cannot exceed Quantity In Stock", vbOKOnly .SetFocus Exit Sub Else
0
2017
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”)) + 1 Because it’s a multiuser form I want every time someone clicks that button, to refresh the form, show any new records (if there are) that have been created from other users, and create a new record to write. I used the following code
0
1576
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 its different in 2007 or if there is a work around? I tried moving the .SetFocus line out of the With statement but same result. With Forms!frmMain!frmSKUInput.Form !WhichSKUCombo.Value = "" !WhichSKUList.Value = "" .RecordSource =...
0
8325
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2743
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 we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.