Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

Type mismatch

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hughess7 - 18 Jan 2006 12:01 GMT
Hi all

I am trying to use the dlookup function and get a type mismatch error. Can
anyone tell me why. The fields in the tables are either double or text
(bracket). Code is:

Dim txtBracket As String
Dim intFuelAmt As Double
Dim intVAT As Double

       txtBracket = Me![cboVehicle].Column(3)
       intFuelAmt = Me![FuelCost]
       intVAT = DLookup("[Amount]", "tblFuel", "FuelCost = " & intFuelAmt
And "Bracket = " & txtBracket)

Thanks in advance for any help.
Sue
Alex Dybenko - 18 Jan 2006 12:10 GMT
hi,
text should be in quotes, and you have to be aware of null, so try:

intVAT = nz(DLookup("[Amount]", "tblFuel", "FuelCost = " & intFuelAmt & "
And Bracket = '" & txtBracket"'"),0)

Signature

Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

> Hi all
>
[quoted text clipped - 13 lines]
> Thanks in advance for any help.
> Sue
hughess7 - 18 Jan 2006 14:48 GMT
Great thanks Alex that sorted it (although you had a missing & before the "'"
after txtbracket.

Cheers
Sue

> hi,
> text should be in quotes, and you have to be aware of null, so try:
[quoted text clipped - 19 lines]
> > Thanks in advance for any help.
> > Sue
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.