Hi everyone!
I have a confirm button in my form which will enter new records in a table and also update another table.
It gives an error if user clicks on button without typing anything in text box.
It was working fine but now its not working.
Its not giving an error,not inserting any records and not even updating table.
I don't have any idea about this.
Can anyone help me with this?
Here is my code:
I have a confirm button in my form which will enter new records in a table and also update another table.
It gives an error if user clicks on button without typing anything in text box.
It was working fine but now its not working.
Its not giving an error,not inserting any records and not even updating table.
I don't have any idea about this.
Can anyone help me with this?
Here is my code:
If IsNull(txtItem) Then
MsgBox "Please fill the required fields", vbInformation
End If
Exit Sub
Issueqty = Me.txtQty
leftQty = curQty - Issueqty
' MsgBox (curQty)
' MsgBox (Issueqty)
' MsgBox (leftQty)
If curQty < 1 Then
MsgBox "Sory There is no item in the inventory", vbInformation
Else
strsql = "Are you sure you want to issue the selected item?"
strsql = MsgBox(strsql, vbYesNo, vbDefaultButton2)
If strsql = vbYes Then
Set cnn = CurrentProject.Connection
Set rs = New ADODB.Recordset
strsql = "UPDATE tblAcqDetails SET fldQty = " & leftQty & " WHERE fkItemID=" & Forms!frmIssue.txtItemID
rs.Open strsql, cnn, adOpenDynamic, adLockOptimistic
'rs.Update
'rs.Requery
' MsgBox (strsql)
strsql = "SELECT * FROM tblStockTake"
rs.Open strsql, cnn, adOpenKeyset, adLockOptimistic
With rs
rs.AddNew
!fkItemID = txtItemID
!fldIssueQty = txtQty
!fldUOM = txtUOM
!fldLocation = txtlocation
!fldCustomer = txtCus
!fldIssueDate = Date
rs.Update
End With
Set rs = Nothing
Set cnn = Nothing
MsgBox ("The selected device is issued")
End If
End If