Dlookup Error doing my head in

CSP12345

Board Regular
Joined
Oct 1, 2014
Messages
52
Hi all,
I suspect this ha been covered but I have tried everything and searched every were please help

Ok I have created a query "query1"
In query1 I have a field "Assest Number" "BatteryType" that is just pulling information direct from a table "3 Yearly Cost"
and in another field "BatteryCost" that I want to look up the cost of the battery from a table "BatteryTb" field "BatteryCost1"

My Expression is this BatteryCost: DLookUp("BatteryCost1","BatteryTb","Batterytype1 =" & [BatteryType])

The Error it is returning is The object doesnt contain the automation object "GP1272"
GP1272 is a battery type that is displaying in the query filed "BatteryType"


Any help please, Im good with Excel but new to Access and the cross over is doing my head in
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If 'BatteryType1' is a text field you need to enclose the criteria value in quotes.

BatteryCost: DLookUp("BatteryCost1","BatteryTb","Batterytype1 ='" & [BatteryType] & "'")
 
Upvote 0
If 'BatteryType1' is a text field you need to enclose the criteria value in quotes.

BatteryCost: DLookUp("BatteryCost1","BatteryTb","Batterytype1 ='" & [BatteryType] & "'")


Mate that worked a treat I am so great full. Just 1 more question since the BatteryCost1 is a currency how do I make the query result display as a currency?
 
Upvote 0
You can set the Format of the field in the query to Currency.

To do that select the field, right click, select Properties... and set the Format property in the property sheet.
 
Upvote 0
You can set the Format of the field in the query to Currency.

To do that select the field, right click, select Properties... and set the Format property in the property sheet.

The format of the table is set to currency but the result in the query returns it as a text eg.

BatteryTb

BatteryType1 BatteryCost1

GP1234 $1.00


Query1

BatteryType BatteryCost

GP1234 1.00
 
Upvote 0
Did you try changing the format of the field/expression BatteryCost in the query?
 
Upvote 0
Sorry I don't follow.

In the Format field of the property sheet there should be a dropdown offering various options, including Currency, for formatting.
 
Upvote 0
Im afraid not for some reason. To be on the same wave length this is in the Query property options for the field right?
 
Upvote 0
No it's in the Field Properties of the field, the Query Properties are, for welll the query.
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top