How to create a code that does the following..

DaniBoy

Registered User.
Local time
Today, 08:18
Joined
Nov 18, 2001
Messages
174
Hello, I have 3 chkboxes that when the value of one is true, I get new feilds to enter data, and if one of the other chkBox is value becomes true then the first goes false and other types of data entry fields appear. Now when I save a record the value of the chkbox that was picked stays true, but the fields stay invisible. How can I make it so whe I look at a form I can see the fields depending on the chkbox that was picked.

Thank you
Daniel
 
I used this in the OnCurrent event to do something similar with enabled/disabled fields, see if it helps:

Code:
Private Sub Form_Current()
Dim blnVisEnabled As Boolean
    
    Me.DeviceName.SetFocus
        
    If Me.DeviceName = "Car Club" Then
        blnVisEnabled = True
    Else
        blnVisEnabled = False
    End If

    Me.LicPlate.Enabled = blnVisEnabled
    Me.VehYear.Enabled = blnVisEnabled
    Me.VehModel.Enabled = blnVisEnabled

End Sub

As far as chainging one checkbox when anothere is changed, look into using Option Groups to control that only one of several options is selected.

HTH,
David R
 
Thanks but am still having problems, I dont understand what event am suppose to use so that when ever I have a check box selected and I look at that record it will do something if the that checkbox is checked.
The problem is when I want to view the records on the form and go through them. The checkbox is checked but what ever its suppose to appear is not until I click on it again. I have the code on a click event. What event would do the same as the click in this situation. Here is my code:


Private Sub chkNew_click()
'Makes the labels and combo boxes for the Cart Change and the Repair disappear and makes the New Construction labels and combo boxes appear

If chkNew.Value = True Then
lblService.Caption = "New Construction"
cboNewCartSize.Visible = False
txtNewCartNum.Visible = False
txtProblem.Visible = False
lblNewCartSize.Visible = False
lblNewCartNum.Visible = False
lblProblem.Visible = False
chkChange.Value = False
chkRepair.Value = False
End If
End Sub


Private Sub chkChange_click()

If chkChange.Value = True Then
lblService.Caption = "Cart Change"
cboNewCartSize.Visible = True
txtNewCartNum.Visible = True
txtProblem.Visible = False
lblNewCartSize.Visible = True
lblNewCartNum.Visible = True
lblProblem.Visible = False
chkNew.Value = False
chkRepair.Value = False
End If
End Sub

Private Sub chkRepair_click()

If chkRepair.Value = True Then
lblService.Caption = "Repair & Replace"
cboNewCartSize.Visible = False
txtNewCartNum.Visible = True
txtProblem.Visible = True
lblNewCartSize.Visible = False
lblNewCartNum.Visible = True
lblProblem.Visible = True
chkChange.Value = False
chkNew.Value = False
End If

End Sub

[This message has been edited by DaniBoy (edited 01-03-2002).]

[This message has been edited by DaniBoy (edited 01-03-2002).]
 
Alright!!!!!! I got it!!!!!! It took me all day but I GOT IT!!!!!!
 
I used the OnCurrent event, hopefully that's what worked for you.
smile.gif

Sorry if I didn't make that clear before.

Cheers,
David R
 

Users who are viewing this thread

Back
Top Bottom