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

Nasty thing

Status
Not open for further replies.

rostulya

Technical User
Jan 7, 2004
15
0
0
US
Hi.
I'm having a bit of a problem here.
I have a subform, that has a field named 'ID' that contains a primary key(autonumber).
When the form is opend, it shows the 'autonumber' in this field. But as soon as i start filling in other fields in the subform, it changes to zero.
I cant figure it out.
I tried not to use autonumber, by using DMAX function - same thing. Field shows correct number, then goes to zeto.
Please help.
 
is the form set to entry only?

what is the form based on? the table direct or a query?
 
originaly it was set to dataentry only.
i changed that - no effect.
the worst thing is that sometime it works, sometime it doesnt.
drives me crazy
 
Can you supply us with a few more details?
When exactly does it change to zero? (after which field is updated)
What do you do differently when it works?
Do you have any "After Update" events that could be influencing this field?

As much as I'd like to help, I can't without some more info.

Kev.


Never trust the French.
How can you trust a country that has 256 different types of cheese.
- Spike Milligan.
 
anyway... i had to make ID textbox unbound, and assign it's value to ID field in OnDirty event.
i think it's working
 
no after update evants. nothing suspicious.
it does work when i open the subform as separate form.
 
What about linked fields between the child and parent?

Never trust the French.
How can you trust a country that has 256 different types of cheese.
- Spike Milligan.
 
this is a data entry form that was made from a regular form, that was, indeed, linked, using the field in question.
 
OK.
Not sure if this will solve your problem exactly, but it may help somewhat.

Create a new field in the table linked to your subform and call it something like 'IDMainForm'.
Add this new field to your subform, and link it to the ID field in your main form.
Now when you create a new Main Form, the ID number for it should be replicated in the field you've just added to the subform. Each record in the subform will continue to have their own unique ID number, but the link to the Main form will be there via the 'IDMainForm' field.

You can make this new field invisible on the subform, as it does not need to be seen, but wait to see if it works first.

Let me know if this helps.

Kev.


Never trust the French.
How can you trust a country that has 256 different types of cheese.
- Spike Milligan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top