S
ShadesOfGrey
All,
I inherited a database that used an update query called from a macro
to change the date stored in a table. That is, whenever the Status
was changed, it would put the date it was changed into a date field.
I decided that the macro/query route was unwieldy and the macro was
causing some other problems, so I replaced those with the below event
procedure whenever I update the contents of the combo box.
Although this compiles and runs without error, it doesn't put a date
into MasterData.StatChgDate. In fact, it doesn't do anything at all,
as far as I can tell. I've never done this before so I'm not sure if
this is a syntax problem or a basic misunderstanding of how to use VBA
to run an Update query. Any advice would be most appreciated.
FYI, it gives no messages even with SetWarnings on...first thing I
checked.
Stan
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Statuscmb_AfterUpdate()
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE MasterData SET MasterData.StatChgDate =
Date() WHERE MasterData.IDNum = [forms]![DataEntry]
Stan
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Statuscmb_AfterUpdate()
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE MasterData SET MasterData.StatChgDate =
Date() WHERE MasterData.IDNum = [forms]![DataEntry]![IDNum"
DoCmd.SetWarnings True
End Sub