How force Dirty=True from unbound field?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an unbound combo box that when a selection is made needs to insert a
record to a related table. I can only do this if the record is 'dirty' and my
primary key has been generated. If they click the combo box before this
happens, I need to somehow get the primary key so I can insert the related
record. What is the best way to do this?
 
In
mscertified said:
I have an unbound combo box that when a selection is made needs to
insert a record to a related table. I can only do this if the record
is 'dirty' and my primary key has been generated. If they click the
combo box before this happens, I need to somehow get the primary key
so I can insert the related record. What is the best way to do this?

You can force the form to become dirty by setting some bound control
equal to its own current value, as in:

Me!txtMyBoundTextbox = Me!txtMyBoundTextbox

However, if it's a new (unsaved) record and your related table has
referential integrity enforced, you still won't be able to add a record
to the related table until this record has been saved. In that case,
you may have to somehow defer adding that record until after the form's
record has been saved.
 
Back
Top