473,704 Members | 6,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

make sure data is entered before going to new form?

493 Contributor
Like your mother-in-law that visits too often, I am back. :-)

I have two tables, two forms. The primary key of table 1 is a foreign key in table two. I have a button on form one that opens form two and it should take the ID autonumber field from the first form and populate the ID field on the second form (and get stored in the table too).

But it's not working. My guess is that technically the data from the first form hasn't populated the database yet so it can't get carried over to form two.

So how do I tell Access that when I click the button to open up form two, go ahead and stick all the data that was entered on form one into the database (but you don't have to go to a new record, just stay put while form two is being filled out - eventually it will be closed).

Is it like a requery or refresh or something like that?

thanks to any and all help,
melissa :-)
Mar 23 '07
129 9111
1,356 Recognized Expert Top Contributor
Gotcha when you open the new form I presume you are using Docmd.openform?
If so add your ID to the openargs like so Docmd.OpenForm ,,,,,,me!Replic ate_ID
Then in the form that pops up go into the onOpen event and you can add the following.
Expand|Select|Wrap|Line Numbers
  1.     If not IsNull(Me.OpenArgs) Then
  2.          me!Replicate_ID = Me.OpenArgs
  3.     End if
You may need the fields to be on the forms if so just set visible to no and your good.
Mar 23 '07 #11
493 Contributor
Hey there,

I'm getting an error message: "You can't assign a value to this object" for that code. :-(

Any idea why?
Mar 26 '07 #12
493 Contributor
Nope, wait, it does work but only if I leave the recipient textbox unbound. I need to get the value transferred through OpenArgs into the 2nd table.

In other words, I have ReplicateID transferred over to the form but I need to get it into the Specimen table (where Replicate.Repli cateID = Specimen.Replic ateID).
Mar 26 '07 #13
493 Contributor
Still can't figure this one out. How do I assign the value passed by OpenArgs to the value in the table?

Thank for any help!
Mar 26 '07 #14
1,356 Recognized Expert Top Contributor
Try to update it manually can you do that?
Mar 26 '07 #15
493 Contributor
What do you mean? :-)
Mar 26 '07 #16
1,356 Recognized Expert Top Contributor
On your form see if you can enter the information from the first form (the info you want carried to the second form) into the field using the keyboard.
Mar 26 '07 #17
493 Contributor
Well, I'm hoping to make the field invisible, so I need it to be filled in automatically.

Essentially, I just need to tell Access that when I click on the button to start adding Specimen information that they are all tied to that one Replicate. So no matter how many Specimens I create with the Specimen form, the same Replicate ID is going into the Specimen table.
Mar 26 '07 #18
1,356 Recognized Expert Top Contributor
Well, I'm hoping to make the field invisible, so I need it to be filled in automatically.

Essentially, I just need to tell Access that when I click on the button to start adding Specimen information that they are all tied to that one Replicate. So no matter how many Specimens I create with the Specimen form, the same Replicate ID is going into the Specimen table.
I understand however for troubleshooting purposes... Make it visible and see if it is updateable (humor me) :) If not then check the underlying recordsource and see if it is updateable in there.
Mar 26 '07 #19
493 Contributor
I'm sorry, I'm a little lost here. If I pass the value using OpenArgs in the DoCmd.OpenForm then it passes successfully to an unbound textbox.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)               'Pass replicate id when form opens
  2. If Not IsNull(Me.OpenArgs) Then
  3.          Me.txt_ReplicateID = Me.OpenArgs
  4.     End If
  5. End Sub
But it doesn't get into the database because it is an unbound textbox.

If I add a textbox that has a control source of tbl_Replicate.R eplicate_ID then I cannot type into it because it is an autonumber field.
Mar 27 '07 #20

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

Similar topics

by: John | last post by:
How do I prevent blank data from being entered into a table? For instance, the user fills out a form, but if a field is left blank, then the entire entry won't be filled in. This isn't necessarily a form validation thing, just that if all the fields are filled, then proceed to enter data, if not then don't. Thanks in advance!
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. tCetecM1CUST (SQL Table that contains the Customer Information) tAccountingDetail (SQL Table that contains the information in the form) frmAccountingEntry (Access form used to enter data) spGetCustomerInformation (Stored Procedure which returns data using...
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address, city, state, etc. When the user wants to search for a particular record, he does two things: 1. On the form is a text box on which he enters the text he is searching for.
by: Saket Mundra | last post by:
I have multiple web forms in my application. The user after logging on is directed to form1 where he enters information desired. Once finished he is directed to form2 and the same procedure goes on till form6. After user has entered information in all 6 forms the information needs to be entered in the database by performing a Transaction. If the data from any of the forms is missing the Transaction is rolled back. My query is where do i...
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
by: Bjorn | last post by:
Hi. Every time i post data in a form the contents are being checked for validity. When i click the back-button, all data is gone and i have to retype it. It's obvious that only a few or none of the visitors will retype it all so i'm asking: "how to preserve POST-data when clicking the back-button?" i've already tried to print post data as a value in a HTML tag but
by: seltzer | last post by:
I am using Access 2000 but I also have the 2003 version. I am working on creating a data entry form in Access for a research study. Since there is a maximum of 255 fields per table in Access, I have to split the fields up (unfortunately). I am creating a form for each section and all of the respective fields, and then I am putting all these forms into one larger form as subforms. I have a few questions & am hoping someone has answers: ...
by: banderson | last post by:
Hello, I am having a problem getting a new record in a subform to append to the underlying table. When I add a new record to the main form, the subform is blank, except for the ID field, which is populated because of its link to the main form. I would like this new record, populated at this point only with the ID from the main form, to then be appended to the underlying table. (The rest of the attributes for that record will be entered in a...
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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,...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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,...
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...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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...
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...
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.