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

Using a Textbox in Form1 to Populate and Store Info in a Textbox in Form2

I am very new to Access and am setting up a database that will house data from biological studies. I have two forms and associated tables set up, the first called "TrapNights" in which information on environmental data during the time of a trap night survey is entered, and a second called "IndividualData" that collects information about specific animals seen during that particular trap night. These two forms/tables are related based on the field "TrapNightID". TrapNightID is the primary key in the TrapNights table, and the foreign key in the IndividualData table.
I want to have the TrapNights form open, have the user enter that data, then click a button that opens up the IndividualData table. The problem I'm having is that I have a textbox field for the TrapNight foreign key in the IndividualData form. I want this to be auto-populated based on the Primary key that was generated for the record that was just entered in the TrapNight form.
At this point, I have the field auto-populating the number, but it is simply displaying the number and is not bound to the field in the table and storing the number in the IndividualData table.
Does anyone know how I can reconcile this and get the data to be stored in the IndividualData table rather than just displaying the number?
Any help would be greatly appreciated, please let me know if any further explanation is necessary. Thank you in advance for any help.
Jul 2 '14 #1

✓ answered by twinnyfo

Is your individual data form a subform on the main form trapnight? It may be wise to do that and that may solve the majority of your problems.

7 1149
twinnyfo
3,653 Expert Mod 2GB
aeroach,

You say that the TrapNightID is the primary key of table TrapNights and in the Foreign Key in table Individual Data. I don't understand the problem.....

Your table should be displaying the ID number of TrapNightID--which is exactly what it is doing.

Perhaps I don't understand your question??
Jul 2 '14 #2
Sorry, let me try to clarify. In my TrapNights form, the TrapNightID textbox is displaying the automatically generated auto-number for that field for each record entered.
In the IndividualData form that opens subsequently, that auto-number is being displayed in the TrapNight textbox field for the IndividualData table, but there is some disconnect, and that number is only displaying in the field and not actually getting sent to and stored in the IndividualData table.
Jul 2 '14 #3
twinnyfo
3,653 Expert Mod 2GB
If your Form/Sub-form is set up with the Master-Child relationship set to TrapNightID, the TrapNightID should be updated automatically with every new record for that TrapNightID. Nor should there be a need to display either the TrapNightID or the IndividualDataID fields on the form.
Jul 2 '14 #4
Yes, I see your point, that is something I intend to remove once I have the database running exactly as intended. I don't want to have the auto-number ID fields displayed on the forms, but for now it's just been a way for me to verify that information is getting transferred to the right places in the way I want it to be. And unfortunately it's not... TrapNightID is updated in the TrapNight form/table as desired... but not in the IndividualData form/table.
I'm not sure if this will help, but here are images of my two forms and the fields I'm dealing with:

TrapNight: http://i.imgur.com/fYNZRfy.jpg
IndividualData: http://i.imgur.com/o0wijfX.jpg

When I open the TrapNight form and enter TrapNightID record 1... then open up IndividualData form, TrapNight in that form is automatically populated to a value of '1'. But it's only showing me that and not putting it into the table.
Jul 2 '14 #5
twinnyfo
3,653 Expert Mod 2GB
Is your individual data form a subform on the main form trapnight? It may be wise to do that and that may solve the majority of your problems.
Jul 2 '14 #6
I had it as two distinct forms... I put the IndividualData form in as a sub-form on TrapNight and that's resolved the issue. Thank you very much for your help!
Jul 2 '14 #7
twinnyfo
3,653 Expert Mod 2GB
Glad that I could help! Let us know if you run across any other snags!
Jul 2 '14 #8

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

Similar topics

2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: John Wildes | last post by:
hello I was wondering if someone could point me in the direction of information on using app.config to store string variables. I have a couple of variables that store path information for file...
2
by: jej1216 | last post by:
Using PHP to populate a form, I am not able to display any text area data -- it displays as blank. <?php echo "<textarea rows=11 cols=120 name=inc_descr value='".$incdescr."'></textarea>"; ?> ...
1
by: miadlor | last post by:
Hi, I've searched and searched..... I'm trying to use a combobox to load a textbox on selection. The problem is the textbox will populate according to what is selected, but not all the info...
1
Bob Ross
by: Bob Ross | last post by:
Is there anyway at all you can populate a password textbox from server side?
1
by: hprudhvi | last post by:
Actually i am learning .NET. please help me in this issue... that is i have a form1 and i have a button in it. If i want to open another form named Form2 by clicking on that button how to do that??
1
by: Erika Domínguez | last post by:
Hi, I'm trying to make a program with 2 Windows Forms. In Form1 there's a textBox and a button, and in Form2 there's a listBox. I want the program to add the items written in the textBox to the...
2
by: jainam shah | last post by:
str = "Select testlib.code, testlib.name, testlib.RATE, testlib.GRP, testlib.lbound, testlib.ubound, testlib.lcode, testlibHEAD.name AS TNAME from testlib, testlibHEAD where testlib.GRP >= '" &...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...
0
agi2029
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,...
0
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...

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.