ahmed_optom
Registered User.
- Local time
- Today, 15:19
- Joined
- Oct 27, 2016
- Messages
- 93
Firstly, thanks guys, I have been viewing this forum for months and its been invaluable for me.
Now I have a problem which I have been stuck on for a few days.
Heres the code :
Dim framecost As Single
Dim rightcost As Single
Dim leftcost As Single
framecost = 0
rightcost = 0
leftcost = 0
DoCmd.OpenForm "DispenseTransaction"
Forms![DispenseTransaction]![txtPatientID] = Me.PatientID
Forms![DispenseTransaction]![OrderID] = Me.OrderID
Forms![DispenseTransaction]![Staff] = txtExaminer.Value
Forms![DispenseTransaction]![Description] = "Dispense"
Forms![DispenseTransaction]![TransactionAmount] = Me.Text205.Value
framecost = DLookup("PurchaseCost", "Frames", FrameReference = Me.FrameReference)
rightcost = DLookup("LensCost", "Prices", LensModel = Me.RightLens)
The first dlookup works fine, the second one, doesnt. The error specifically says 2471 , the expression you entered as a query parameter produced this error 'LensCost'.
Now usually to me this means the criteria is a string and i adjust with the apostrophe's. I have tried many combinations of apostrophes, square brackets and speech marks and I just cant get this to work.
In debugging screen, when I hover over me.rightlens, it gives me the correct value, but when I hover over lensmodel, it says empty. Which is not right.
Any ideas?
Now I have a problem which I have been stuck on for a few days.
Heres the code :
Dim framecost As Single
Dim rightcost As Single
Dim leftcost As Single
framecost = 0
rightcost = 0
leftcost = 0
DoCmd.OpenForm "DispenseTransaction"
Forms![DispenseTransaction]![txtPatientID] = Me.PatientID
Forms![DispenseTransaction]![OrderID] = Me.OrderID
Forms![DispenseTransaction]![Staff] = txtExaminer.Value
Forms![DispenseTransaction]![Description] = "Dispense"
Forms![DispenseTransaction]![TransactionAmount] = Me.Text205.Value
framecost = DLookup("PurchaseCost", "Frames", FrameReference = Me.FrameReference)
rightcost = DLookup("LensCost", "Prices", LensModel = Me.RightLens)
The first dlookup works fine, the second one, doesnt. The error specifically says 2471 , the expression you entered as a query parameter produced this error 'LensCost'.
Now usually to me this means the criteria is a string and i adjust with the apostrophe's. I have tried many combinations of apostrophes, square brackets and speech marks and I just cant get this to work.
In debugging screen, when I hover over me.rightlens, it gives me the correct value, but when I hover over lensmodel, it says empty. Which is not right.
Any ideas?