DevastatioN
Registered User.
- Local time
- Today, 02:44
- Joined
- Nov 21, 2007
- Messages
- 242
Hello,
Slight problem getting this to work... Let's say I have tblMain and tblSub. tblMain has an ID, and tblSub has an ID2 Autonumber, ID (Linked to ID from tblMain), and then some other fields.
Form1 is based on tblMain and Form2 is based on tblSub. I have a button on Form1 that is supposed to open up Form2 based on the ID of what is on Form1. This works fine, either through Query, VB Code, or any other method I can make this work.
The problem occurs that, if there are no records yet in tblSub, I want this form to open up blank so the user can enter information, but I want the ID field in Form2 automatically populated to link to Form1.
For example, I am on Form1 and the ID is 15... I click the button to open Form2 and I see only records pertaining to ID 15... if I click "new record" I want that new record to automatically be linked to ID 15.
I tried to use VB code of:
If the ID doesn't equal the ID from Form1 then
ID = ID from Form1
End If
It says that I cannot set the value of this field however.
Any ideas, or a link to a sample database would be excellent. I imagine this is used quite a bit in inventory databases. Thanks!
Slight problem getting this to work... Let's say I have tblMain and tblSub. tblMain has an ID, and tblSub has an ID2 Autonumber, ID (Linked to ID from tblMain), and then some other fields.
Form1 is based on tblMain and Form2 is based on tblSub. I have a button on Form1 that is supposed to open up Form2 based on the ID of what is on Form1. This works fine, either through Query, VB Code, or any other method I can make this work.
The problem occurs that, if there are no records yet in tblSub, I want this form to open up blank so the user can enter information, but I want the ID field in Form2 automatically populated to link to Form1.
For example, I am on Form1 and the ID is 15... I click the button to open Form2 and I see only records pertaining to ID 15... if I click "new record" I want that new record to automatically be linked to ID 15.
I tried to use VB code of:
If the ID doesn't equal the ID from Form1 then
ID = ID from Form1
End If
It says that I cannot set the value of this field however.
Any ideas, or a link to a sample database would be excellent. I imagine this is used quite a bit in inventory databases. Thanks!