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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabbed form not working right

Status
Not open for further replies.

Linda354

Technical User
Jan 2, 2002
59
0
0
US
I have a long input form that I'm using the tab feature with, which isn't working properly at this point. My initial table's primary key is autonumbered, called ID, then all subsequent tables are linked with the "relationship" tool to that primary key, through an "ID" field which is a number field. I have the referential integrity on, with both cascading options on. Page one uses the autonumbered primary key of the first table, subsequent pages show that table's "ID" field, but the field is not enabled.

I fill out the first page of the tabbed form, click on the tab to the second page, but the ID number does not carry over onto that page. I get an error message that "index or primary key cannot contain a null value."

Anybody have any idea what's going on?
 
It sounds like you have independent subforms. All datasources are bound at runtime when the form is launched, so they technically have a snapshot of their data cached in memory. Unless you tell the subordinate forms to Requery, they do not reconize the update on the primary table.

Put a routine in your primary form on the AfterUpdate method to force the subordinate forms to Requery and recognize the addition of the new key. This is simply done as Me!ObjectName.Requery petersdaniel@hotmail.com
"If A equals success, then the formula is: A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut." --Albert Einstein

 
I don't understand where I'm to put this instruction. I looked in the properties for the first subform and I did not find an "After Update" event listed. Tried selecting "requery" macro on "exit" but that didn't work.
 
The afterUpdate event is found under the properties dialog when you click on the form or subform header (square in the upper left hand corner when in design mode). petersdaniel@hotmail.com
"If A equals success, then the formula is: A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut." --Albert Einstein

 
Okay, I've found the After Update event. Now, am I supposed to add to each tabbed subform, or just the main page? You said to use Me!ObjectName.Requery I assume that's not a literal command, but I'm not sure what I'm supposed to substitute where.

I don't even know whether to choose "expression builder" or "code builder" as I don't know what the difference between them is.
 
Expression Builder allows you to build simple data calculations and advanced formulae without investing a lot of time in VB coding.

To do the VB Requery Methods, you need to enter into Code Builder. This takes you into the VB editing module. The afterUpdate event that you use should be on the form that would be edited first as it is Updated, it calls to the other forms and tells them to get fresh data

The code I gave you is psuedo-code since I can't see your form.

Me refers to the base form object. Me!ObjectName.Requery

"ObjectName" would be the targeted subform you want requeried.

It sounds like you are drifting into some advanced development areas without the aid of knowing where things are located. I would suggest that you pick up a Book on Developing Applications in Access. WROX Press has excelent books ( petersdaniel@hotmail.com
"If A equals success, then the formula is: A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut." --Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top