Invalid identifier following null constant

I

Imran J Khan

I have a formA that opens to show either existing records or new record
depending on the cmd Button used to open it.
When open for new record, it opens without error. But when moving to a new
reocrd after opening either as a new reocrd or existing reocord, I have the
following error:
"-2147352567 (80020009)
There is an invalid use of the .(dot) or ! operator or invalid parenthses.
You may have entered an invalid identifier or typed parenthses following the
null constant."
I chose the debug button, and it takes me the this procedure:
Public Sub setDTId()
If Nz(DTId, "") = "" Then
DTId = "ABC"
End If
End Sub
The second line ' If Nz(deliveryTermId, "") = "" Then' is highlighted. If I
press F8, it comes up with the same error message above.

I can't fiqure out what is wronge.
Imran
 
I

Imran J Khan

DTId is a textbox in FormA. Datatype is text (example "ABC").

I am using the routine on form.current event and on dblclick event of
another textbox in the same form. It is meant to check if DTId textbox is
empty, if it is, it should assign value "ABC".

The sub is Public, I don't remember making it that, could that be a reason.
I think it should work fine as private sub.

Thanks for your reply Dale.

Imran
 
I

Imran J Khan

Gave error improper use of me.
I removed me. because it is a class module for FormA.
Gave same error as fist post, except run-time error2447
Imran

Dale_Fye via AccessMonster.com said:
What happens if you try:

Public Sub setDTId()

me.DTld = NZ(DTId, "ABC)

End Sub

The method above will take care of NULLs, but not empty strings. The method
below will check for either NULL or ""

Public Sub setDTId()

if len(me.DTld & "") - 0 then me.DTld "ABC"

End Sub
DTId is a textbox in FormA. Datatype is text (example "ABC").

I am using the routine on form.current event and on dblclick event of
another textbox in the same form. It is meant to check if DTId textbox is
empty, if it is, it should assign value "ABC".

The sub is Public, I don't remember making it that, could that be a reason.
I think it should work fine as private sub.

Thanks for your reply Dale.

Imran
What is DTld?
[quoted text clipped - 25 lines]
I can't fiqure out what is wronge.
Imran

--
HTH

Dale Fye

Message posted via AccessMonster.com
 
I

Imran J Khan

It is the code module of FormA itself.

JimBurke via AccessMonster.com said:
Not clear on what you mean by 'it is a class module for FormA'. Is this code
in the code module of FormA itself (i.e. if you're in design mode in FormA
and you do a View, Code is it there)? Or is it in a separate module which
FormA accesses? If it's within FormA itself I can't see why that wouldn't
work. If it's in another module you need to qualify the control name, i.e.

Forms!FormA!CDtld

Not sure I got your control name right.

Gave error improper use of me.
I removed me. because it is a class module for FormA.
Gave same error as fist post, except run-time error2447
Imran
What happens if you try:
[quoted text clipped - 31 lines]
I can't fiqure out what is wronge.
Imran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top