L
lauriecking
I am working on a subform for an orders database. The subform is based
on a query called qryOrdersExtended, the fields are as such:
OrderID tblOrderDetails
ServicesID tblOrderDetails
ServicesName tblServices
UnitPrice tblOrderDetails
Quantity tblOrderQuantity
ExtendedPrice: CCur([tblOrdersDetail].UnitPrice*[Quantity])
On the AfterUpdate on the combobox with the ServicesID and
ServicesName (SELECT DISTINCT tblServices.ServicesID,
tblServices.ServicesName FROM tblServices ORDER BY
tblServices.ServicesName
The code used as follows:
Private Sub ServicesID_AfterUpdate()
On Error GoTo Err_ServicesID_AfterUpdate
Dim strFilter As String
'Evaluate filter before it's passed to DLookup function.
strFilter = "ServicesID = " & Me!ServicesID
'Look up service's unit price and assign it to UnitPrice control
Me!unitprice = DLookup("UnitPrice", "tblServices", strFilter)
Exit_ServicesID_AfterUpdate:
Exit Sub
Err_ServicesID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ServicesID_AfterUpdate
End Sub
Everytime I would run my form, I would select a Service, I will get
"Data Type Mismatch in Criteria Expression" I cannot figure out what
is wrong. There are no data type mismatch at all. Could someone help
me.? I have have been dealing with this one issue for over a week.
Thanks.
on a query called qryOrdersExtended, the fields are as such:
OrderID tblOrderDetails
ServicesID tblOrderDetails
ServicesName tblServices
UnitPrice tblOrderDetails
Quantity tblOrderQuantity
ExtendedPrice: CCur([tblOrdersDetail].UnitPrice*[Quantity])
On the AfterUpdate on the combobox with the ServicesID and
ServicesName (SELECT DISTINCT tblServices.ServicesID,
tblServices.ServicesName FROM tblServices ORDER BY
tblServices.ServicesName
The code used as follows:
Private Sub ServicesID_AfterUpdate()
On Error GoTo Err_ServicesID_AfterUpdate
Dim strFilter As String
'Evaluate filter before it's passed to DLookup function.
strFilter = "ServicesID = " & Me!ServicesID
'Look up service's unit price and assign it to UnitPrice control
Me!unitprice = DLookup("UnitPrice", "tblServices", strFilter)
Exit_ServicesID_AfterUpdate:
Exit Sub
Err_ServicesID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ServicesID_AfterUpdate
End Sub
Everytime I would run my form, I would select a Service, I will get
"Data Type Mismatch in Criteria Expression" I cannot figure out what
is wrong. There are no data type mismatch at all. Could someone help
me.? I have have been dealing with this one issue for over a week.
Thanks.