strange combo box behaviour

  • Thread starter Thread starter darren via AccessMonster.com
  • Start date Start date
D

darren via AccessMonster.com

1) I have a frm with a related subfrm which contains child data. On the
subfrm I have a combo box, the sql of which references a foreign key field on
the main frm. However, when I change main record the combo box still
references the last records foreign key. It is not requerying the sql on
record change.

2) I tried adding some code to the on current event of the subfrm but this
has thrown up some more strange behaviour. When I go to create a new record,
I get an error message saying that a record in the tbl behind the subfrm
cannot create a record as the FK (which relates the child to the parent )is
null, even though I haven't tried to create a child record. The code
contained seems to be irrelavant, if I take it out the error goes, but as
soon as I add any code the error reappears.

???? Getting frustrated.

P.S. Acc2003
 
What is the SQL for the combobox on your subform?

If the criteria is using the mainform, you may want to do
this on the ENTER event of the subform control:

if me.dirty then me.dirty = false
me.subform_controlname.form.combobox_controlname.requery

this will save the main record and requery the subform combobox

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
you're welcome, Darren ;) happy to help

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
Back
Top