First Subform record gets modified when closing form

D

DaNick

I have a simple subform that has a field that is linked to the main form’s field. I use a combo box in the main form that filters records in the subform that match. All seems to work except when I close the main form.

Say I am looking at a record “A” in the main form’s combo box which has two corresponding records shown in the subform as “Apple” and “Apricot”
Then I use the combo to select record “B” in the main form which then filters the subform to show records “Banana” and “Berry”. All is good.

But if I now close the main form, record “Apple” somehow gets modified to “Banana” I think that the reason this is happening is that no matterwhat record I pick in the combo box, the main form always seems to stay onRecord 1. Unless I use the navigation buttons to go to the record.

Anyone know how to fix this so that the main form no only filters the subform, but also navigates to that record in the main table as well?

Thanks
 
J

John W. Vinson

I have a simple subform that has a field that is linked to the main form’s field. I use a combo box in the main form that filters records in the subform that match. All seems to work except when I close the main form.

Say I am looking at a record “A” in the main form’s combo box which has two corresponding records shown in the subform as “Apple” and “Apricot”
Then I use the combo to select record “B” in the main form which then filters the subform to show records “Banana” and “Berry”. All is good.

But if I now close the main form, record “Apple” somehow gets modified to “Banana” I think that the reason this is happening is that no matter what record I pick in the combo box, the main form always seems to stay on Record 1. Unless I use the navigation buttons to go to the record.

Anyone know how to fix this so that the main form no only filters the subform, but also navigates to that record in the main table as well?

Thanks

My guess is that the combo box is bound to a field in the mainform's table. If
you're using a combo box just for navigation or filtering, it must be UNBOUND
- nothing in its Control Source property. Otherwise it will indeed overwrite
the field with the selected value.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
D

DaNick

My guess is that the combo box is bound to a field in the mainform's table. If
you're using a combo box just for navigation or filtering, it must be UNBOUND
- nothing in its Control Source property. Otherwise it will indeed overwrite
the field with the selected value.
--

             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com

Thanks John,
Your guess was right.
I made the combo unbound and it's working as it should. Can't believe
I missed that.

Thanks again
 
A

Access Developer

DaNick said:
. . . Can't believe I missed that.

Nick, if I had a dollar for every time I've thought the same over my
computer career, I wouldn't need a retirement plan. <GRIN>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top