Record not updating right away

L

Linda RQ

Using Access 2003. I have a combox lookup field on a form. When I double
click on that field, my physician subform opens up to add a new physician.
When I add a new physician, I have to enter the last name, then first name
and click back into the last name field then click ok for that name to show
up in the list. If I don't do it exactly right and click into the next
record for instance, I have to close the database before the new physician
name shows up in my list. I have a command button on this subform and in
the "on click" event procedure I have this code below. Not sure if it's
doing anything and I really don't know what it's saying (I had help from an
expert <g>) but if I need to add something to this or put something
somewhere else I would be grateful for some help. I'm sure I didn't give
enough info or perhaps I didn't explain it right so guidance on what to tell
you is welcome and appreciated as well.

Private Sub cmdOK_Click()
On Error GoTo Err_cmdOK_Click

If Me.Dirty Then
DoCmd.RunCommand (acCmdSaveRecord)
Forms!frmMainDataEntry.sfmPtThpy.Form.PhysID_fk.Requery
End If
DoCmd.Close

Exit_cmdOK_Click:
Exit Sub

Err_cmdOK_Click:
MsgBox Err.Description
Resume Exit_cmdOK_Click

End Sub


Thanks,
Linda
 
A

Arvin Meyer [MVP]

I assume the list is a combo or list box. Requery it after the save, and by
the way you can force a save faster with:

If Me.Dirty = True Then 'always be explicit in your code
Me.Dirty = False
Me.NameOfCombo.Requery
End If
 

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