Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle First Record in Table

Status
Not open for further replies.

PaulaJ

Programmer
Jun 20, 2000
130
US
I have a relational db with 4 related tables. Top level table has Key 1, next down has Key 1 and Key 2, next down has Key 1, 2 and 3...etc. I've created a selection form with a subform displaying the next level down for each level. Level 1 form allows you to choose the associated Level 2 records, Level 2 form allows to you choose the associated Level 3 records...etc.

How do I handle the first time a row is added for the associated keys? I have a Level 1 record and want to add the first associated Level 2 record. I'm trying to fill in the key 1 information on the Level 2 form and it keeps telling me that I can't assign a value to any of the fields on the Level 2 form.

There has to be a good way to handle this situation, but I haven't come up with the right group of words to search, either here or in Microsoft Knowledge Base. Any suggestions?
 
Paula,

I do this with VB. I open all the recordsets. Suppose we open them as r1, r2 and r3


r1.addnew
r1.fields(?) = ?
' etc fill in what you wish
r1.update

r2.addnew
r2![ID1] = r1![ID1]
r2.fields(?)
etc
r2.update

r3.addnew
r3![ID1] = r1![ID1]
rs![ID2] = r2![ID2]
r3.update

at each update the new record is added and the respective ID if it is an autonumber.

Does that help?

If you need more code, ask for it.

rollie@bwsys.net
 
Thank you for the quick response. I am pretty new at Access and I was hoping to avoid all of the error checking necessary for using programmatic recordsets. I'd be perfectly happy if it just displayed the form with the subform without any records or even visible=false and have to hit the ADD button to add a new record. Is there any other way to tell that there aren't any records in the table before the LOAD event occurs? I'm trying to keep it simple.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top