Update query problem (1 Viewer)

sponsoraw

Registered User.
Local time
Today, 05:47
Joined
Jan 21, 2013
Messages
25
Hi, it is probably very simple but I can work it out what is wrong. I've got a query initiated by a button on a form. That query should update fields based on what you choose from another field. For some reason I have to click twice on that button to see the changes on the form.

The code is:
Private Sub Equip_Data_Upd_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "equipment_update_qry", acViewNormal
DoCmd.Save
Forms![comp_statement_fm].Refresh
End Sub

Any ideas? I'm still a bit of a novice to do with VBA.
Thanks
Adrian
 

jdraw

Super Moderator
Staff member
Local time
Today, 00:47
Joined
Jan 23, 2006
Messages
15,397
One thing I notice is that you turn warnings off

Code:
DoCmd.SetWarnings False
but you do NOT turn them back on.
Suggest you add a line, before the End Sub

Code:
DoCmd.SetWarnings True
 

sponsoraw

Registered User.
Local time
Today, 05:47
Joined
Jan 21, 2013
Messages
25
Thanks, will add. Any ideas my the form don't show the changes and I have to click twice?
 

Users who are viewing this thread

Top Bottom