Help on update query (1 Viewer)

sponsoraw

Registered User.
Local time
Today, 04:18
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 and its always bringing me to the first record. Can anyone help?
Thanks
Adrian
 

pr2-eugin

Super Moderator
Local time
Today, 04:18
Joined
Nov 30, 2011
Messages
8,494
Is it possible for us to see the code inside the Click method of the Button..
 

sponsoraw

Registered User.
Local time
Today, 04:18
Joined
Jan 21, 2013
Messages
25
There no realy a code. I've just used a simple macro for that. Nothing complicated.
SetWarnings - NO
OpenQuery - arguments - Equipment_update_qry, Datasheet, Edit
 

sponsoraw

Registered User.
Local time
Today, 04:18
Joined
Jan 21, 2013
Messages
25
if there is however a better way I can drop the macro and use VBA, but I'm an novice with VBA.
 

sponsoraw

Registered User.
Local time
Today, 04:18
Joined
Jan 21, 2013
Messages
25
Ok guys, I've get rid of the macro and put some code for it.

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

The code works, but I need to click the button twice to see the changes on the form. Anyone know how to get round this?
Thanks
Adrian
 

Users who are viewing this thread

Top Bottom