Me.Dirty Help

A

Alex

I've tried writing all kinds of code in my control AfterUdate event on my
form that will update all the bound fields in my open record. I have tblOne
with fieldRefPart and tblTwo with fieldRefPart, fieldCost, fieldNumber. My
query joins bothRefPart fields. I have a combo box on my form that is bound
to tblOne fieldRefPart. I need the fieldCost and fieldNumber on my form to
update immediately when a new Refpart is selected. I would think it would be
very simple. I've tried: If Me.Dirty Then Me.Dirty = False and Me.Dirty =
False. I realize the record is being saved, but the fields are not
refreshing on the open form.

So I tried:
If Me.Dirty Then Me.Dirty = False
If IsOpen("NewPartInputfrm") Then
Forms!NewPartInputfrm.Refresh
Forms!NewPartInputfrm.Requery
DoCmd.OpenForm "NewPartInputfrm", acNormal, , strWhere

This refreshes the form, but moves to the first record. Can someone please
tell me exactly the code to update my record and refresh the form while
keeping the form open to the current record? Thank you very much.
 
J

jahoobob via AccessMonster.com

If you use a query that has all the information you want to populate other
fields in a form from a combo box based on that query you can fill in other
fields on the form thusly:

Private Sub Name_of_your_combo_AfterUpdate()
Me.fieldCost = Me.Name_of_your_combo.Column(1)
Me.FieldNumber = Me.Name_of_your_combo.Column(2)
End Sub

Column(1) refers to the second column of the combo box source. The first
column is Column(0).
Hope this helps. Let us know,
Bob
 
A

Alex

No, that is not what I want. All I need to do is refresh my form, just as I
would if I were to close and re-open it. I need to refresh it and keep it on
the same record that is open after my combobox has been updated. Thanks.
 

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