GoldenFireTiger
MIS
Hi there. I have several forms on my database, but the problem concerns frmDelivery and frmItem. On the Delivery form, there is a sub form called subDeliveryDetails. On this form there is a text box (txtQuantityReceived), which contains the quantity of a particular item which has been recieved. On the item form, there is a text box (txtItemQuantityInStock) and this contins the item quantity in stock. I want the quantity in stock to update once a delivery is recieved. If I can do this without a button, please let me know. At the minute, I have tried to create a button called 'update'. The code I have entered on the buttons' on click is as followed:
Private Sub cmdUpdate_Click()
On Error GoTo Err_cmdUpdate_Click
Dim stDocName As String
Dim stLinkCriteria As String
IntNum = QuantityRecieved.Value
stDocName "frmItem"
stLinkCriteria = "[ItemCode]=" & "'" & Me.subDeliveryDetails![ItemCode] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms.frmItem![ItemQuantityInStock].Value = Forms.frmItem![ItemQuantityInStock].Value + IntNum
DoCmd.Close
Exit_cmdUpdate_Click:
Exit Sub
However, this doesn't work, and when i try to un it I get a message box which says error expected sub or function or property, and the line "stDocName "frmItem"" is highlighted.
Can anyone explain what is wrong with this code, or suggest an alternative? Thanks!
Private Sub cmdUpdate_Click()
On Error GoTo Err_cmdUpdate_Click
Dim stDocName As String
Dim stLinkCriteria As String
IntNum = QuantityRecieved.Value
stDocName "frmItem"
stLinkCriteria = "[ItemCode]=" & "'" & Me.subDeliveryDetails![ItemCode] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms.frmItem![ItemQuantityInStock].Value = Forms.frmItem![ItemQuantityInStock].Value + IntNum
DoCmd.Close
Exit_cmdUpdate_Click:
Exit Sub
However, this doesn't work, and when i try to un it I get a message box which says error expected sub or function or property, and the line "stDocName "frmItem"" is highlighted.
Can anyone explain what is wrong with this code, or suggest an alternative? Thanks!