473,326 Members | 2,081 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,326 software developers and data experts.

Microsoft Access/VBA Forms

I developed data entry forms in ms access. On the first form, user types ID number and all other forms captures the number. After user enter data in one form, they click on a button and the next form opens. The first past thru all forms works. The second pass, first two forms works fine, the third form gives error "DoCmd.OpenForm action cancelled" and does not capture ID number. Please help! This is the code for the button:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command117_Click()
  2. On Error GoTo Err_Command117_Click
  3.  
  4. Dim stDocName As String
  5. Dim stLinkCriteria As String
  6. DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  7.  
  8. stDocName = "FOURTH_PAGE"
  9.  
  10. stLinkCriteria = "[SUBJECT_ID]=" & "'" & Me![SUBJECT_ID] & "'"
  11. DoCmd.OpenForm stDocName, , , stLinkCriteria
  12. Forms![FOURTH_PAGE]![SUBJECT_ID].Value = Me![SUBJECT_ID].Value
  13. Forms![FOURTH_PAGE]![PEXAM].SetFocus
  14.  
  15. DoCmd.Close acForm, "THIRD_PAGE"
  16.  
  17.  
  18. Exit_Command117_Click:
  19. Exit Sub
  20.  
  21. Err_Command117_Click:
  22. MsgBox Err.Description
  23. Resume Exit_Command117_Click
  24.  
  25. End Sub
Apr 20 '10 #1
4 2249
TheSmileyCoder
2,322 Expert Mod 2GB
Hi and welcome to Bytes.

Please remember to use [code][/code] tags around your code, it makes it easier to read.

Between the lines
Expand|Select|Wrap|Line Numbers
  1. stLinkCriteria = "[SUBJECT_ID]=" & "'" & Me![SUBJECT_ID] & "'"
  2. DoCmd.OpenForm stDocName, , , stLinkCriteria
insert this line:
Expand|Select|Wrap|Line Numbers
  1. msgbox stLinkCriteria
To make sure the criteria looks as expected.
Furthermore if the forms have been set to Data Entry only, you do not actually need to open them with a criteria, as they will be "empty" when you open them
Apr 21 '10 #2
Thank you for your reponse. This part of the project works now but yet another error has occurred. One of the tables was saving a blank record. I wrote a delete query and put it in the form_AfterUpdate event. This takes care of the blank record but when the user goes back to the previous record (maybe to correct or check) then comes back to the current record the run-time error 3329 occurs and it puts #DELETE in all of the forms controls. However if the user tab/enter thru the form or click on the next navigation button, they can continue entering and the entered data is in the table correctly. Any and all advice would be greatly appreciated.
Apr 28 '10 #3
TheSmileyCoder
2,322 Expert Mod 2GB
I honestly don't think you should write delete querys to handle empty record problems...You need to find out why a empty record is inserted in the first place.
Apr 28 '10 #4
NeoPa
32,556 Expert Mod 16PB
I agree. That would be a more reliable way to resolve your issue. Otherwise you're likely to be falling over related problems for some while I expect.
Apr 28 '10 #5

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

Similar topics

3
by: Giloosh | last post by:
Hello, i have a microsoft access application and right now, anyone knowing how to use microsoft-access can easily go behind the applicatio, design the forms, delete edit/tables etc... There is...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
71
by: Lauren Wilson | last post by:
Hello folks, Would love yo get all informed opinions and/or facts on the following: Over the last few weeks I have spent quite a bit of time reviewing all the Access and .NET stuff I could...
17
by: Pam Ammond | last post by:
I need to use Microsoft Access Automation within a Visual Studio 2003 program written in C# for Windows Forms. When a button is clicked in my VS.NET program, I want it to run a Microsoft Access...
2
by: thechaosengine | last post by:
Hi eveyone, If anyone could advise on the following I would be truly greatful: I have a fairly standard set up. An IIS 5.1 website set up with anonymous access allowed in all areas of the site...
41
by: Rob R. Ainscough | last post by:
I keep hearing persistant rumors (along with my own experience) that .NET is going to be abandon by Microsoft due to performance & security issues? I realize no one from Microsoft is likely to...
2
by: Can | last post by:
I have a Microsoft Access front end, SQL server backend and I am using .dll files to complete the n-tier application. How do I reference an unbound textbox (from Microsoft Access) in the .dll? ...
1
by: Nick | last post by:
Hi Has anyone encountered the "readonly" issue with Microsoft Forms 2.0 TextBox ? The locked property of the control seems to have no effect - always enabled regardless of whether it's set to...
0
by: calvinkwoo3000 | last post by:
My Window application run property withour link to mdb without password. Once i set security password to mdb file, the error belor come out when i click detail. Not a valid password. and detail...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.