View Full Version : Access Hates Me


robertbrockie
05-02-2001, 10:32 AM
Hey Guy's I'm now at a point where my relationships are set up BUT when I add a new record, and DO NOT add a related record the program craps out. What I think I need is when I add a new user I need to increment my related form (creating a blank form) inorder for it to continue.

Thats pretty hard to understand, well listen here is my problem:

I have 2 forms
1. Internation Student Information
2. Internatioal Spouse's Information

These forms are related one to one with a field called ID. When I input information in form 1, with ID 1, I should be able to press the command button (for Spouse Info) and input that Students spouse infomation, and I can. But the problem is that Not all Students are married, so insted of typing NONE in all the time I want that form to remain blank, but still increase the ID field. Can you guys help me

Thanks alot for your time,

Robert Brockie.

charityg
05-02-2001, 10:52 AM
Autonumbering the field that relates to your main form is NEVER a good idea. If a records is somehow created and deleted and your autonumbering gets screwed up then you'll have a huge relationship mess! I know how you feel, though, I used to think Access hated me too. I think to accomplish what you need, you should set the ID value of the subform equal to the main form ID value. I would put this in the beforeinsert event of the main form.
me!subform!id=parent!id
Get rid of autonumbering on the table that your subform is based on!

robertbrockie
05-02-2001, 11:00 AM
thanks charityg, but I have NO clue about this language they use, where do I put that piece of code.
Where in the main form is the before insertevent???

Thanks,

Robert Brockie

[This message has been edited by robertbrockie (edited 05-02-2001).]

charityg
05-02-2001, 11:25 AM
Please check Access help on Event Procedures.

Rich
05-02-2001, 01:49 PM
Use a subform for spouse information use ID as the foreign key for spouse then give spouse table a unique autonumber it will be irrelevant then if then student doesn't have a spouse.