By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

another Dlookup problem...

P: 24
I'm creating a database for work and i've run into a snag. Currently i'm using to nested dlookup statements and they are searching for certain criteria in order to find the correct value the statement reads:

= DLookup ( "[tbl Cost Center]![Description]" ," tbl Cost Center", "[tbl Cost Center]![CC]= DLookUp("[tbl People]![CC]","tbl people","[tbl People]![EmployeeNumber]= Forms![Requests]![cmbRequestor]")")

i've swapped the quotations marks and have tried god knows how many syntaxs for numeric and text. The first dlookup criteria is text. the second dlookup criteria is numeric. I've exhausted everything i know how to do.

The error message is as follows:

"...Database can't parse the expression..."
Jun 4 '07 #1
Share this Question
Share on Google+
11 Replies


Rabbit
Expert Mod 10K+
P: 12,315
=DLookup("[Description]" ,"[tbl Cost Center]", "[CC]=" & DLookUp("[CC]","[tbl people]","[EmployeeNumber]=[Forms]![Requests]![cmbRequestor]"))
Jun 4 '07 #2

P: 24
"...syntax error (missing operator) in query expression '[CC]='..."
Jun 4 '07 #3

Rabbit
Expert Mod 10K+
P: 12,315
"...syntax error (missing operator) in query expression '[tbl cost center]![CC]='..."
CC is a text value?

Expand|Select|Wrap|Line Numbers
  1. =DLookup("[Description]" ,"[tbl Cost Center]", "[CC]='" & DLookUp("[CC]","[tbl people]","[EmployeeNumber]=[Forms]![Requests]![cmbRequestor]") & "'")
Jun 4 '07 #4

P: 24
yes cc is a text value in the cost center database
Jun 4 '07 #5

Rabbit
Expert Mod 10K+
P: 12,315
Okay, then use the new code I provided.
Jun 4 '07 #6

P: 24
says that action failed... no error message provided...

action failed:
macro name: SetDept
Condition: True
Action name: Setvalue
Arguments:.....
Jun 4 '07 #7

Rabbit
Expert Mod 10K+
P: 12,315
says that action failed... no error message provided...

action failed:
macro name: SetDept
Condition: True
Action name: Setvalue
Arguments:.....
You're trying to do this through a macro? I was not aware of that. I thought you were just using it as the control source of a textbox.
Jun 4 '07 #8

P: 24
yes im doing it through expression builder under the 'build event' option...

is there another way to populate the field without using dlookup?

what i'm trying to accomplish is filling a field with a value that is retrieved from another database so far as a 'username' or 'account number' is the same...
Jun 5 '07 #9

P: 24
ok so i was playing around with the macro and i seem to got it to work but there's another problem that popped up...

"The object doesn't contain the automation object ' description retrieved '. you tried to run a visual basic procedure to set a property or method for an object. However, the component doesn't make the property or method available for automation operations. Check the component's documentation for information on the properties and methods it makes available for automation operations."
Jun 5 '07 #10

P: 24
i figured out the problem. for future reference when using macro's to build an expression that will retreive a string value do not use an equals (=) sign in the expression field. the equal sign will command access to search for a property with the retrieved name which in many cases will give an error message. thanx rabbit for the help!
Jun 5 '07 #11

Rabbit
Expert Mod 10K+
P: 12,315
i figured out the problem. for future reference when using macro's to build an expression that will retreive a string value do not use an equals (=) sign in the expression field. the equal sign will command access to search for a property with the retrieved name which in many cases will give an error message. thanx rabbit for the help!
Not a problem, good luck.
Jun 5 '07 #12

Post your reply

Sign in to post your reply or Sign up for a free account.