Hi,
I am trying to create and run a update query totally in code in ACCESS 2000 but despite reading postings in here along the same lines I dont seem to be able to get it to work - maybe I am missing something.
This is the code I am using and the SQL:
------------Code start------------------
Private Sub LibraryNo_AfterUpdate()
Dim strsql As String
DoCmd.SetWarnings False
strsql = (UPDATE tblRecordings SET tblRecordings.MediaFormatID = 3
WHERE (((tblRecordings.MediaFormatID) Is Null) AND ((tblRecordings.LibraryNo) Like "CD-S *");
DoCmd.RunSQL (strsql)
DoCmd.SetWarnings True
End Sub
----------------code end----------------------
Now if I just create a normal update query, it all works fine but its just when I do it as pure code that it wont.
Access turns the following into red text in the VBA Debug window:
strsql = (UPDATE tblRecordings SET tblRecordings.MediaFormatID = 3
WHERE (((tblRecordings.MediaFormatID) Is Null) AND ((tblRecordings.LibraryNo) Like "CD-S *");
Any guidence, suggestions or help would be great.
Thank you,
Kimi
I am trying to create and run a update query totally in code in ACCESS 2000 but despite reading postings in here along the same lines I dont seem to be able to get it to work - maybe I am missing something.
This is the code I am using and the SQL:
------------Code start------------------
Private Sub LibraryNo_AfterUpdate()
Dim strsql As String
DoCmd.SetWarnings False
strsql = (UPDATE tblRecordings SET tblRecordings.MediaFormatID = 3
WHERE (((tblRecordings.MediaFormatID) Is Null) AND ((tblRecordings.LibraryNo) Like "CD-S *");
DoCmd.RunSQL (strsql)
DoCmd.SetWarnings True
End Sub
----------------code end----------------------
Now if I just create a normal update query, it all works fine but its just when I do it as pure code that it wont.
Access turns the following into red text in the VBA Debug window:
strsql = (UPDATE tblRecordings SET tblRecordings.MediaFormatID = 3
WHERE (((tblRecordings.MediaFormatID) Is Null) AND ((tblRecordings.LibraryNo) Like "CD-S *");
Any guidence, suggestions or help would be great.
Thank you,
Kimi