there is an invalid use of the . (dot) or ! operator or invalid parentheses

J

jac

I keep getting this error message:
"there is an invalid use of the . (dot) or ! operator or
invalid parentheses"

this is the code that seems to cause it:
curOrderSubTotal = Me!txtOrderSubTotal
 
M

Marshall Barton

jac said:
I keep getting this error message:
"there is an invalid use of the . (dot) or ! operator or
invalid parentheses"

this is the code that seems to cause it:
curOrderSubTotal = Me!txtOrderSubTotal


What is txtOrderSubTotal? Double check the spelling every
where.
 
J

John Vinson

I keep getting this error message:
"there is an invalid use of the . (dot) or ! operator or
invalid parentheses"

this is the code that seems to cause it:
curOrderSubTotal = Me!txtOrderSubTotal

Shouldn't. Could you post some more of the context? Is
curOrderSubTotal the name of a form control or of a VBA variable?
 
J

jac

curOrderSubTotal is a VBA variable declared as currency.
txtOrderSubTotal is a textbox on the form.
I have tried curOrderSubTotal = Nz(Me.txtOrderSubTotal, 0)
but I still get the same error. There is a lot of code on
this command button.
Is it possible that the control is corupt?

thanks,
 
G

Guest

I tried that but it did not work. I even tried
curOrderSubTotal = Nz(Me.txtOrderSubTotal, 0),
and that did not work.
There is a lot of code on this command button. Is it
possible that the control is corupted?

thanks,
 
J

jac

-----Original Message-----
jac said:
I keep getting this error message:
"there is an invalid use of the . (dot) or ! operator or
invalid parentheses"

this is the code that seems to cause it:
curOrderSubTotal = Me!txtOrderSubTotal


What is txtOrderSubTotal? Double check the spelling every
where.
--
Marsh
MVP [MS Access]
.
New information: The controlsource is set to =[Forms]!
[frmOrderEntry_debug]![ctlSubForm]![txtSubTotal]
but if I remove the controlsource, the code will work
fine.
What I am trying to do is assign the textbox a value from
a subform. Inside of the "add record" button code I want
to get the value in the textbox and assign it to the a
variable. This is where the problem is.

thanks,
 
J

John Vinson

curOrderSubTotal is a VBA variable declared as currency.
txtOrderSubTotal is a textbox on the form.
I have tried curOrderSubTotal = Nz(Me.txtOrderSubTotal, 0)
but I still get the same error. There is a lot of code on
this command button.
Is it possible that the control is corupt?

That, or the . ! error lies somewhere else in your code. If you
Compile the project does it compile OK? or does it highlight this line
of code? Why do you feel that this line is at fault?
 
M

Marshall Barton

-----Original Message-----
jac said:
New information: The controlsource is set to =[Forms]!
[frmOrderEntry_debug]![ctlSubForm]![txtSubTotal]
but if I remove the controlsource, the code will work
fine.
What I am trying to do is assign the textbox a value from
a subform. Inside of the "add record" button code I want
to get the value in the textbox and assign it to the a
variable. This is where the problem is.

You've lost me. What control source are you talking about?

If you have text box expression that calculates a value from
other text boxes and are trying to retrieve that value in
code, you could be running into a timing issue. If a
subform text box is trying to retrieve a value from a main
form text box, the subform may be trying to get the value
before the main form has loaded the data.

Other than those straw grasping thoughts, you should try
John's compile all suggestion.
 
J

jac

-----Original Message-----


That, or the . ! error lies somewhere else in your code. If you
Compile the project does it compile OK? or does it highlight this line
of code? Why do you feel that this line is at fault?


.
I think this is line is at fault because when I single
step thru the code, it goes from this line to the On
Error GoTo Err_cmdAddRecord_Click code.
Another thing that is going is that when I change the
textbox (Me.txtOrderSubTotal) controlsource to nothing it
works fine. But if I set the controlsource to =Forms!
frmOrderEntry!ctlSubForm!txtSubTotal it causes an error.

thanks,
 
J

John Vinson

=Forms!
frmOrderEntry!ctlSubForm!txtSubTotal it causes an error.

Try

Forms!frmOrderEntry!ctlSubForm.Form!txtSubTotal

and check that ctlSubForm is the name *of the Subform control*, not
the name of the form within that control (I think you have this right,
that statement is more for the lurkers whom might be reading this)
 
J

John Vinson

John, thanks for staying with this.
I tried to fully qualify it as you suggested. It did not
work. ctlSubForm is the name the control that holds the
subform.

I really suspect that you have some sort of subtle corruption in the
form. I'd suggest that you follow the repair suggestions at
http://www.granite.ab.ca/access/corruptmdbs.htm - repairing,
Decompiling, creating a new database and importing and so on as
needed.
 

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