A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

why does it ask me to add ID number



 
 
Thread Tools Display Modes
  #1  
Old January 21st, 2010, 09:31 PM posted to microsoft.public.access.forms
Carla
external usenet poster
 
Posts: 166
Default why does it ask me to add ID number

Hi, my database has a main table called OBS ID with a primary key called
OBS_ID with is a foreign key in the following tables: Counter Measures,
Critical Behaviours, Critical conditions, Well_Dones.

I have created a data entry form to add data to my main table with buttons
that you click if you need to add data to one of the above mentioned tables
(not always the case). When I click the button to open any one of the 4 four
forms based on the above mentioned tables, the form won't let me save because
it wants be to add the OBS_ID data. I assumed that this would just fill in
correctly because all the tables are linked with a one to many relationship
back to the main table. How can I fix this so that the data is being added to
the OBS_ID that is on my main form?
  #2  
Old January 21st, 2010, 11:46 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default why does it ask me to add ID number

This will only happen automatically when you are using a subform to add data
to one of the other 4 tables.

You can use subforms, or an alternative is to supply the OBS_ID for each of
the other forms when you open them.
You can use OpenArgs to pass the value of OBS_ID from the main form to one
of the other forms when you open it from the main form.

Something like this
DoCmd.OpenForm [NameOfForm], , , , , ,Me.OBS_ID

Then on the open event of the form being opened you can put

If Not IsNull Me.OpenArgs Then
Me.OBS_ID.DefaultValue = Me.OpenArgs
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



"Carla" wrote in message
...
Hi, my database has a main table called OBS ID with a primary key called
OBS_ID with is a foreign key in the following tables: Counter Measures,
Critical Behaviours, Critical conditions, Well_Dones.

I have created a data entry form to add data to my main table with buttons
that you click if you need to add data to one of the above mentioned
tables
(not always the case). When I click the button to open any one of the 4
four
forms based on the above mentioned tables, the form won't let me save
because
it wants be to add the OBS_ID data. I assumed that this would just fill
in
correctly because all the tables are linked with a one to many
relationship
back to the main table. How can I fix this so that the data is being added
to
the OBS_ID that is on my main form?



  #3  
Old January 21st, 2010, 11:46 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default why does it ask me to add ID number

On Thu, 21 Jan 2010 13:31:06 -0800, Carla
wrote:

Hi, my database has a main table called OBS ID with a primary key called
OBS_ID with is a foreign key in the following tables: Counter Measures,
Critical Behaviours, Critical conditions, Well_Dones.

I have created a data entry form to add data to my main table with buttons
that you click if you need to add data to one of the above mentioned tables
(not always the case). When I click the button to open any one of the 4 four
forms based on the above mentioned tables, the form won't let me save because
it wants be to add the OBS_ID data. I assumed that this would just fill in
correctly because all the tables are linked with a one to many relationship
back to the main table. How can I fix this so that the data is being added to
the OBS_ID that is on my main form?


A relationship between tables does NOT automagically add records or field
values to your table. When you use a command button to open a separate form,
that form has no way to know where it's been called from or what the current
Obs ID is on some *other* form.

Rather than a button opening a separate form, you can put these four forms on
the main form as Subforms (they can be on individual pages of a Tab Control if
you don't want the screen all cluttered). Make the Master Link Field and Child
Link Field of each subform [Obs ID] and it will cause the subform to inherit
the current value on the mainform.
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.