Question : Forms, tab control and subforms

Hi experts,
I have a main form that has a tab control with 6 tabs on it.  The main form is used for both adding a new record and editing existing records.   2 of the tabs are linked to the same query(table) but 4 of the tabs have subforms that have different queries but are linked to the same master/child fields as the main form.  My problem is when I select "Add New Project" from my menu bar and the form opens up...(I have a function that creates a new project id), I can add data to the form but if I tab to the next tab (one that has a different query) I get a no current record error....when I go to this second tab without adding any new data to the main form, I can open the proofs tab without an error and begin to add data but once I leave it I get errors again....hope this makes sense...I need to be able to add one of more proofs to the new record or....in the case of the 3rd query(another tab), add a outside contractor to the new record, I need to be able to update this data to the new record as well....i have tried to requery the subform but as they isn't a record for this yet this doesn't work or....perhaps its part of the problem...????
let me know what questions you have.

thanks
Schuyler

Answer : Forms, tab control and subforms

1. You don't need an end if as long as the entire if statement is on one line.
2. of course its a design issue ;-)
Check each of the index/primary keys in the query, and in the subforms. There's one in there that's not gotten a value when you go to save.
Maybe toggle a break in code and in the immediate window display each piece of data for each record, especially including the ones not included in the query.
I really wish there were a simple way to exchange databases. But EE doesn't want to allocate the space, and i don't have a server.
i don't know if you can just enter something like this is the immediate window, but if you stick it into your code so you can see whats what, maybe like this:

OnError goto Printem

Printem:
for each fld in tblProjectOrder
    debug.print fld.Name, fld.value
next

for each fld in tblRequestorsPS
    debug.print fld.Name, fld.value
next

for each fld in tblRequestorAccts
    debug.print fld.Name, fld.value
next

And make sure to include all the tables related to the form and subforms you're saving when you close the main form

then cut and paste the results and we'll find the culprit. But its a missing value somewhere.
Random Solutions  
 
programming4us programming4us