Hi. I'm a novice trying to update a field (LotNum) in an access table (Product Input) using an update statement. I'm updating through a form that the user fills out under two conditions: 1. the LotNum field is empty, and 2. the appropriate tank is selected. First I was getting a Write conflict error until i entered the null statement. Now i get an "object required" error.
Dim stSql As String
Dim rs As Object
Dim con As Object
Set con = Application.CurrentProject.Connection
txtLotNum.SetFocus
stSql = "Update [Blendsheet Input] "
stSql = stSql & "set [LotNum] = '" & txtLotNum.Text & "'"
stSql = stSql & "where [TankNum] = '" & cboTankNum.Value & "';" & LotNum is Null
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 3 ' 3 = adModeReadWrite
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.RunCommand acCmdClose
Set rs = Nothing
Set con = Nothing
Exit_cmdSave_Close_Click:
Exit Sub
Err_cmdSave_Close_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Close_Click
End Sub
Any help would be greatly appreciated
Dim stSql As String
Dim rs As Object
Dim con As Object
Set con = Application.CurrentProject.Connection
txtLotNum.SetFocus
stSql = "Update [Blendsheet Input] "
stSql = stSql & "set [LotNum] = '" & txtLotNum.Text & "'"
stSql = stSql & "where [TankNum] = '" & cboTankNum.Value & "';" & LotNum is Null
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 3 ' 3 = adModeReadWrite
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.RunCommand acCmdClose
Set rs = Nothing
Set con = Nothing
Exit_cmdSave_Close_Click:
Exit Sub
Err_cmdSave_Close_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Close_Click
End Sub
Any help would be greatly appreciated