Currency and If Statement

B

Bob Quintal

(e-mail address removed) wrote in
Hi. I'm trying to write simple code on a subforms On Current
event to disable/enable a command button based on the value of a
text box. The textbox is formatted to currency. Here's a sample
of what I need but it's not working (I think because of the
currency).

if me.totalpurchase > 250 then
cmd.PrintGC.enabled = true
else
cmd.PrintGC.enabled = false
end if

Hope someone can help.
cmd.PrintGC isn't a valid Controlname, it cannot have a period. If
you are trying to reference PrintGC on form cmd

Forms!cmd!PrintGC.enabled = true
Since you are in the code module for the form, Forms!cmd! should be
replaced with Me!PrintGC.enabled = true
 
C

cathywoodford

Hi. I'm trying to write simple code on a subforms On Current event to
disable/enable a command button based on the value of a text box. The
textbox is formatted to currency. Here's a sample of what I need but
it's not working (I think because of the currency).

if me.totalpurchase > 250 then
cmd.PrintGC.enabled = true
else
cmd.PrintGC.enabled = false
end if

Hope someone can help.
 

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