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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile Error

Status
Not open for further replies.

SysDupe123

Technical User
Dec 17, 2003
74
US
I'm getting a compile error and I've got a basic function in my query. I haven't had this before and I'm at a loss at what to do. This is the entry that is giving me trouble.


Key2: [first name] & [last Name] & Trim(Val(Right([CustID],4)))

How can I get this to work?
 
The use of the Trim() function is unnecessary, as the Val() function returns a number, which cannot have leading/trailing spaces. I'd imagine this type mismatch is what is causing your error.


-V
 
It is hard to tell what parts of this you need:

Trim(Val(Right([CustID],4)))

I imagine

Right([CustID],4)

Would be sufficient.
 
Double check your references:
in the VBE, menu Tools -> References ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tried using just Right([CustID],4) too and it still is giving me a compile error.
 
Have you checked the references of your VBA project ?
Does the database compile properly ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Please post the complete line with some context.
 
Thanks PHV! I tried to compile and it worked fine afterwards!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top