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

Very "basic" help required

Status
Not open for further replies.

Luvsql

Technical User
Apr 3, 2003
1,179
CA
I am new to VBA, have read through the VBA for dummies, but I still can't figure out how to mark a checkbox field checked, as opposed to not checked. I am using Dynamics GP, have added the window that it appears on (SalesDocumentPrintOptions) as well as the field (Include).

When the form is opened, the field I'd like to default as checked is greyed out until the user checks the PickingTicket checkbox, then the field I want checked becomes available.

Is this something simple to do or am I missing something, which I'm sure I am! Any suggestable samples would be appreciated!
 
I think the code you would use would roughly be something like:
CheckBox1.Value = True 'this defaults the checkbox to checked
CheckBox2.Enabled = False ' greyed out
If CheckBox1.Value = False Then
CheckBox2.Enabled = True
End If


Crabback
 

It usually helps to look in Properties for the control.

If you place a CheckBox on your Form, it is unchecked. It helps to know that you need to mess with Value of the Checkbox, so if you look at the Value of your Checkbox, it is False. So change it to True will make it Checked.

I know, how do you know that it is a Value of this control? Well, now you know :) And it is the same for option button (radio button), so now you know 2 controls :)

Have fun.

---- Andy
 
When the form is opened, the field I'd like to default as checked is greyed out until the user checks the PickingTicket checkbox"

If it is greyed out until the user DOES something, then there has to be some other logic going on.

That being said, Andy is correct. If you want the default to be checked, then change the Value property to True.

Have the Project window open (Ctrl-R), and the Properties window open (F4). Now either select the control (the checkbox) on the userform, or select the control from the dropdown at the top of the Properties window. Scroll down the Properties and change the False of Value to True.

faq219-2884

Gerry
My paintings and sculpture
 

If the checkbox is bound to an underlying table, in the Design View for the table, set the Default value to -1.

If the checkbox is not bound to an underlying table, use this code

Code:
Private Sub Form_Load()
 MyCheckBox = -1
End Sub


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
The value of this field is set to 1 and if I try and change it in the properties tab, I get an error "unsafe operation: operation cannot be performed in the target's field 'AfterUserChange, BeforeLostFocus, or AfterLostFocus Events."

 
I'm sorry, I missed the reference to Great Plains,. Assumed this was a VBA question, being in a VBA forum. Youneed to post this in a Dynamic GP forum. Just Google, there's some of them out there.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top