If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Enable if check box = true - WON'T WORK

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Sep 2003
Location: Washington, DC
Posts: 116
Angry Enable if check box = true - WON'T WORK

Can anyone help with this? I'm trying to enable a field if the value of a check box is true.

Private Sub ECash_AfterUpdate()
If ECash = True Then Me.ECashAmt.Enable = True Else Me.ECashAmt.Enable = False
End If
End Sub
Reply With Quote
  #2 (permalink)  
Old
Grand Poobah
 
Join Date: Sep 2003
Location: MI
Posts: 3,713
Quote:
Originally Posted by PatrickFAO
Can anyone help with this? I'm trying to enable a field if the value of a check box is true.

Private Sub ECash_AfterUpdate()
If ECash = True Then Me.ECashAmt.Enable = True Else Me.ECashAmt.Enable = False
End If
End Sub
What are the controls in question?

Try:

EcashAmt.Enabled=false
If ECash.Value=True then EcashAmt.Enabled=True
__________________
Back to Access ... ADO is not the way to go for speed ...
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Location: Inverurie
Posts: 628
Quote:
Originally Posted by PatrickFAO
Can anyone help with this? I'm trying to enable a field if the value of a check box is true.

Private Sub ECash_AfterUpdate()
If ECash = True Then Me.ECashAmt.Enable = True Else Me.ECashAmt.Enable = False
End If
End Sub
Try this:

Code:
ECashAmt.Enabled = False 'Put this on the form load procedure

IF ECash.Value = True Then

  Me.ECashAmt.Enabled = True

Else

  Me.ECashAmt.Enabled = False

End If

Last edited by cruickshanks; 10-22-04 at 08:44.
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Sep 2003
Location: Washington, DC
Posts: 116
I get a compile error: method or data member not found.
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Location: Inverurie
Posts: 628
ok, what version of access are you using?
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Sep 2003
Location: Washington, DC
Posts: 116
Version 2K3
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Location: Inverurie
Posts: 628
Quote:
Originally Posted by PatrickFAO
Version 2K3
Ok. Seeing as im at work, i only have access 97 on my machine here.

I have created a database that does the operation that you are trying to do.

Hopefully that'll help, because i was going to ask you to send me a copy of your database so i could take a look and see if i could get it going for you.
Attached Files
File Type: zip db2.zip (7.2 KB, 45 views)
Reply With Quote
  #8 (permalink)  
Old
Registered User
 
Join Date: Sep 2003
Location: Washington, DC
Posts: 116
i got a bunch of fatal errors on the db. here's mine.
Reply With Quote
  #9 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Location: Inverurie
Posts: 628
It won't work with Access 97 im afraid.

Which control did you put the code onto? ECash or ECashAmt?
Reply With Quote
  #10 (permalink)  
Old
Registered User
 
Join Date: Sep 2003
Location: Washington, DC
Posts: 116
sorry here it is
Attached Files
File Type: zip db1.zip (105.5 KB, 26 views)
Reply With Quote
  #11 (permalink)  
Old
Registered User
 
Join Date: Sep 2004
Location: Reston, VA
Posts: 86
Put this code in the ECash checkbox's Click event, instead of the After_Update:

ECashAmt.Enabled = ECash

That should do what you want.
Reply With Quote
  #12 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Location: Inverurie
Posts: 628
it doesn't work with access 97. The code it told you before, did you put it on the ECash control or the ECashAmt control?

I put it on the ECash control and it worked.
Reply With Quote
  #13 (permalink)  
Old
Registered User
 
Join Date: Sep 2003
Location: Washington, DC
Posts: 116
My VB has a C++ runtime error and can't get into the code now.
Reply With Quote
  #14 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Location: Inverurie
Posts: 628
not good. try restarting your pc and pray it works again.
Reply With Quote
  #15 (permalink)  
Old
Registered User
 
Join Date: Dec 2003
Location: Dallas, TX
Posts: 996
Quote:
Originally Posted by BummerJeff
Put this code in the ECash checkbox's Click event, instead of the After_Update:

ECashAmt.Enabled = ECash

That should do what you want.
BummerJeff is correct,

Set the property for your TextField to Enabled=No
ECash being your CheckBox and ECashAmt being your CheckBox.

niters all
Bud
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On