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

Invalid use of the . (dot) or ! operator or invalid parens

Status
Not open for further replies.

mdweezer

Technical User
Jun 15, 2004
56
US
My code was working fine, I made a few changes to a report, but didn't touch this form but now all of a sudden I get that error on the following line:
Code:
StatusValue = Nz(Status_Code.Value)

It was working flawlessly before, what could have triggered it?
 
Try this:
StatusValue = Nz([Status_Code].Value)
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
My functionw works fine, I only get the error when the Status field is null

any ideas?
 
Hi!

You need to tell Nz what value to take when it sees a null. This is usually a 0 or a "" or Date() depending on the data type involved.

Example:

StatusValue = Nz([Status_Code].Value, 0)

for a numerical StatusValue

hth


Jeff Bridgham
bridgham@purdue.edu
 
Jebry,

That's incorrect. If the second argument is not supplied then either a 0 or an empty string is returned according to context. This info is straight out of Help.

Weezer,

Have you tried compiling the code to see where the error is?

Craig
 
I was able to overcome the code using:

Code:
If IsNumeric(Status_Code) Then
    StatusValue = Nz(Status_Code.Value)
Else
    StatusValue = 0
End If
 
Hi Craig!

Yes I realize that you can let Access decide but, IMO, is never a good idea. Again, IMO, it is always best to give the program explicit instructions on any data type and any conversions you want Access to do. I thought that this could be a case where explicit instructions might help. It is something else to try anyway.

hth


Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top