moving from one subform to another (1 Viewer)

majhl

Registered User.
Local time
Today, 04:17
Joined
Mar 4, 2008
Messages
89
I have two subforms on a main form. When I move out of the last control of the first subform, I use the following code to move to the first control of the second subform:

Forms!frmFMVisit!frmSubFamilyEthnicDetails.SetFocus

This is giving me problems in that it appears that moving out of the control in this way seems to be creating a record in the table on which the first subform is based.

I get the following message:

'Cannot the value 'NULL' into column 'DoB'; column does not allow nulls. INSERT fails.'

I'm not sure of what I'm doing wrong here. Is there a way to navigate between subforms without this happening?

Thanks for any help.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:17
Joined
Aug 30, 2003
Messages
36,133
Well, when you leave the first subform, Access will try to save the record. There's no way to avoid that with a bound form if that's your question.
 

majhl

Registered User.
Local time
Today, 04:17
Joined
Mar 4, 2008
Messages
89
Well, when you leave the first subform, Access will try to save the record. There's no way to avoid that with a bound form if that's your question.

Thanks for the reply. Are you suggesting that I need to make my (sub)form unbound? That seems like a lot of extra work.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:17
Joined
Aug 30, 2003
Messages
36,133
I made no suggestion, I simply pointed out how Access works. For this to be a problem for you suggests the table design isn't normalized, or perhaps the form isn't laid out to accommodate the design. Are the subforms bound to the same table? If so, why?
 

majhl

Registered User.
Local time
Today, 04:17
Joined
Mar 4, 2008
Messages
89
I made no suggestion, I simply pointed out how Access works. For this to be a problem for you suggests the table design isn't normalized, or perhaps the form isn't laid out to accommodate the design. Are the subforms bound to the same table? If so, why?

Thank you pbaldy. Yes it was a problem with how the form was laid. I've now re-organised slightly and things are OK.
 

Users who are viewing this thread

Top Bottom