I'm trying to update all the rows in a column (column A, PO Number) within a table (iSupplierTable). The value (txtPONbr) is entered by the user on a form (NewPO). Any assistance would be greatly appreciated.
Thanks,
Ray
Code:
Private Sub cmdSubmit_Click()
On Error GoTo cmdSubmit_Click_Error
Dim db As Database
Dim rst As DAO.Recordset
Dim strSQL As String
strSQL = "iSupplierTable"
Set db = CurrentDb()
Set rst = db.OpenRecordset(strSQL)
With rst
.Edit
If ![PO Number] = Null Then
![PO Number] = [Forms]![frmNewPO]![txtPONbr]
End If
.Update
End With
[Forms]![frmNewPO]![txtPONbr] = ""
[Forms]![frmNewPO]![txtPONbr].SetFocus
cmdSubmit_Click_Error:
If Err.Number = 3022 Then
MsgBox "You have entered a PO Number that already exists in the table!"
Else
If Err.Number = 3058 Then
MsgBox "You must enter a PO number!"
End If
End If
End Sub
Thanks,
Ray