Hi,
I have On Load, Current, After Update events on a form, which all work fine. But, when I add a Before Update, I get the error: "Procedure declaration does not match description of event or procedure having the same name". Can anyone please help me to resolve this issue. Following is my code:
I have On Load, Current, After Update events on a form, which all work fine. But, when I add a Before Update, I get the error: "Procedure declaration does not match description of event or procedure having the same name". Can anyone please help me to resolve this issue. Following is my code:
Code:
Private Sub Form_Load()
If InStr(Me.Filter, "=") > 0 Then
If IsNumeric(Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "="))) Then
Me.Tag = (Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "=")))
End If
End If
End Sub
Private Sub CmboMinute_AfterUpdate()
Me.CollectionTime = Me.CmboHour & ":" & Me.CmboMinute
Me.Refresh
End Sub
Private Sub Form_Current()
Dim strTime As String
Dim strHour As String
Dim strMinute As String
Dim intcolon As Integer
If IsNull(CollectionTime.Value) Then
Me.CmboHour = ""
Me.CmboMinute = ""
Else
strTime = CollectionTime.Value
intcolon = InStr(strTime, ":")
If intcolon <= 0 Then Exit Sub
strHour = Left$(strTime, intcolon - 1)
strMinute = Right$(strTime, Len(strTime) - intcolon)
Me.CmboHour = strHour
Me.CmboMinute = strMinute
End If
End Sub
Private Sub Form_BeforeUpdate()
MsgBox "Hello"
End Sub
' Change the status of the order to "Completed" once the remaining units = 0
Private Sub Form_AfterUpdate()
Dim dbs As DAO.Database
Dim rstTest As DAO.Recordset
Dim strQuery As String
Dim rstUpdate As DAO.Database
Dim strQuery2 As String
Dim db As Database
strQuery = "SELECT OrderingT.Order_ID, OrderingT.UnitsRequested,OrderingT.OrderStatus, ([UnitsRequested])-Count([Product_ID]) AS [The Remaining Units] " + _
"FROM (OrderingT INNER JOIN PackingSlipT ON OrderingT.Order_ID = PackingSlipT.Order_ID) INNER JOIN ProductT ON PackingSlipT.PackingSlip_ID = ProductT.PackingSlip_ID " + _
"WHERE (PackingSlipT.PackingSlip_ID = " & Form.Tag & ") " + _
"GROUP BY OrderingT.Order_ID, OrderingT.UnitsRequested , OrderingT.OrderStatus;"
Set db = CurrentDb
Set rstTest = db.OpenRecordset(strQuery)
If Not rstTest.EOF Then
If rstTest![The Remaining Units] = 0 Then
MsgBox "This order was completely filled "
strQuery2 = "UPDATE OrderingT " + _
"SET OrderingT.OrderStatus = 'Completed' " + _
"WHERE (((OrderingT.Order_ID)= " & [rstTest]![Order_ID] & " )); "
db.Execute strQuery2
End If
End If
End Sub