Freedom Computers

ACCESS

SQL Sample coding



Dim UpdateString
Dim IntA As Integer
Dim NewInvNo As Integer
NewInvNoString = "SELECT INTO [IntA] FROM [T-CompanyDetails] WHERE ((([T-CompanyDetails].CompanyId)=1));"
DoCmd.RunSQL NewInvNoString

UpdateString = "UPDATE [T-InvNo] SET [T-InvNo].InvNo = " & NewInvNo & " WHERE ((([T-InvNo].InvId)=1));"
DoCmd.Hourglass True
'Turns off the Access warning messages
DoCmd.SetWarnings False
DoCmd.RunSQL UpdateString
DoCmd.Hourglass False
'Turns the Access warning messages back on
DoCmd.SetWarnings True




Dim strDataUpdate As String
strDataUpdate = "UPDATE [T-InvNo] SET [T-InvNo].InvNo = 5 WHERE ((([T-InvNo].InvId)=1));"
DoCmd.RunSQL strDataUpdate