SeanDelere
Registered User.
- Local time
- Today, 04:39
- Joined
- Sep 7, 2004
- Messages
- 51
Hello again all,
I have a form which has a subform which is based on a Query.
Updating a TextBox on the main form does a requery and displays the results in the subform.
I am trying to continue if there are records present or open a second form if the recordset is empty.
This code used to work but I have changed something and now I get the error "Object Variable or With Block Variable not set" I don't know what I changed to break the code.
Private Sub TextSupCodeSearch_AfterUpdate()
Dim exist, result1, result2
Me.Requery
TextSupCodeSearch.SetFocus
Me.Recordset.MoveFirst
exist = Me.Recordset.ProductID
If exist = "" Then
result1 = MsgBox("Enter New Product into Database?", 36, "Not Found in Database")
If result1 = 6 Then
DoCmd.OpenForm "NewProdForm"
Else
End If
Else
result2 = MsgBox("Please add or update the order in the Table", 64, "Product already exists in Database")
End If
End Sub
I have a form which has a subform which is based on a Query.
Updating a TextBox on the main form does a requery and displays the results in the subform.
I am trying to continue if there are records present or open a second form if the recordset is empty.
This code used to work but I have changed something and now I get the error "Object Variable or With Block Variable not set" I don't know what I changed to break the code.
Private Sub TextSupCodeSearch_AfterUpdate()
Dim exist, result1, result2
Me.Requery
TextSupCodeSearch.SetFocus
Me.Recordset.MoveFirst
exist = Me.Recordset.ProductID
If exist = "" Then
result1 = MsgBox("Enter New Product into Database?", 36, "Not Found in Database")
If result1 = 6 Then
DoCmd.OpenForm "NewProdForm"
Else
End If
Else
result2 = MsgBox("Please add or update the order in the Table", 64, "Product already exists in Database")
End If
End Sub