Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLOOKUP Issue 1

Status
Not open for further replies.

Fireman1143

IS-IT--Management
Mar 5, 2002
51
US
Having a DLOOKUP issue where it constantly returns a null value.

I have the following code on my form and the first part does work:

Private Sub cboApptVehicleYMM_AfterUpdate()
Me.txtVehicleMakeModel = Trim(Mid([ApptVehicleYMM], 6)) ' This Works
Me.txtSvcPriceCode = DLookup("[ST_PricCode]", "qryApptPricCode", "Trim([ST_Make_Model]) = 'Trim(Mid(Me.[ApptVehicleYMM], 6))'")
End Sub

The qry is qryApptPricCode with two fields (both txt):
ST_Make_Model
ST_PricCode

I used the Trim function on the [ST_Make_Model] as I found some input had a space or two at the end, I figured this would eliminate that.

Thanks
Mike
 
Try:

Code:
 Me.txtSvcPriceCode = DLookup("[ST_PricCode]", "qryApptPricCode", "Trim([ST_Make_Model]) = '[highlight #FCE94F]" & [/highlight]Trim(Mid(Me.[ApptVehicleYMM], 6))[highlight #FCE94F] & "[/highlight]'")

And since you use [tt]qryApptPricCode[/tt] query, why don't you [tt]Trim[/tt] data in the fields when this query is created?

---- Andy

There is a great need for a sarcasm font.
 
Thanks Andrzejek [thanks]

Works like a charm. I will look at updating it to do the Trim in the query.

Mike
 
Fireman1143,

Be sure to mark the thread as answered by clicking the Great Post link.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top