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

Change Data Information in code

Status
Not open for further replies.

shankbanta

Technical User
Apr 15, 2003
43
0
0
US
In my form there are three check boxes. Depending on the selection (1, 2 or 3) other fields got/lost focus, special effects, etc. Here is the code:
************************************************************
Private Sub Form_Current()
If (test = 0) Then
Forms!BTDENTRY!select = 0
Forms!BTDENTRY!BanCovQty.BackColor = RGB(193, 193, 193)
Forms!BTDENTRY!CustCovQty.BackColor = RGB(193, 193, 193)
Forms!BTDENTRY![cus text].SpecialEffect = 0
Forms!BTDENTRY![ban text].SpecialEffect = 0
Forms!BTDENTRY!BanCovQty.Enabled = False
Forms!BTDENTRY!CustCovQty.Enabled = False
Forms!BTDENTRY!BanCovQty.SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.SpecialEffect = 0
ElseIf (test = 1) Then
Forms!BTDENTRY!BanCovQty.Enabled = True
Forms!BTDENTRY!CustCovQty.Enabled = False
Forms!BTDENTRY!SheetNo.Enabled = True
Forms!BTDENTRY![ban text].SpecialEffect = 1
Forms!BTDENTRY![cus text].SpecialEffect = 0
Forms!BTDENTRY!BanCovQty.SpecialEffect = 2
Forms!BTDENTRY!CustCovQty.SpecialEffect = 0
Forms!BTDENTRY!BanCovQty.BackColor = RGB(230, 10, 79)
Forms!BTDENTRY!CustCovQty.BackColor = RGB(193, 193, 193)

ElseIf (test = 2) Then
Forms!BTDENTRY!CustCovQty.Enabled = True
Forms!BTDENTRY!BanCovQty.Enabled = False
Forms!BTDENTRY!SheetNo.Enabled = False
Forms!BTDENTRY![cus text].SpecialEffect = 1
Forms!BTDENTRY![ban text].SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.SpecialEffect = 2
Forms!BTDENTRY!BanCovQty.SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.BackColor = RGB(230, 30, 70)
Forms!BTDENTRY!BanCovQty.BackColor = RGB(193, 193, 193)
Me!Endsheets.TabStop = No
Me!EndQty.TabStop = No
Me!EndShtSavedFrame.TabStop = No
ElseIf (test = 3) Then
Forms!BTDENTRY!CustCovQty.Enabled = False
Forms!BTDENTRY!BanCovQty.Enabled = False
Forms!BTDENTRY!SheetNo.Enabled = False
Forms!BTDENTRY![cus text].SpecialEffect = 0
Forms!BTDENTRY![ban text].SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.SpecialEffect = 0
Forms!BTDENTRY!BanCovQty.SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.BackColor = RGB(230, 30, 70)
Else
Forms!BTDENTRY!select = 0
Forms!BTDENTRY!BanCovQty.BackColor = RGB(193, 193, 193)
Forms!BTDENTRY!CustCovQty.BackColor = RGB(193, 193, 193)
Forms!BTDENTRY![cus text].SpecialEffect = 0
Forms!BTDENTRY![ban text].SpecialEffect = 0
Forms!BTDENTRY!BanCovQty.Enabled = False
Forms!BTDENTRY!CustCovQty.Enabled = False
Forms!BTDENTRY!SheetNo.Enabled = False
Forms!BTDENTRY!BanCovQty.SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.SpecialEffect = 0
End If

Forms!BTDENTRY!LowBindCt.Enabled = False
End Sub

***********************************************************

What I am trying to accomplish:

User checks #2 and enters a number into the corresponding field (CustCovQty)and then realizes they should have entered the information with check #1 (BanCovQty). The number that they entered into CustCovQty (Corresponding to check #2) stays. I would like to have that changed to zero when check #1 is selected.

I hope this is clear, if not ask plenty of questions.

I am picking up someone elses code.

Thanks
 
Are the check boxes part of an option group? if so, I would add the code to the after update event and make it a Select Case statement.

Example

Private Sub OptionBox1_AfterUpdate()
Select Case Me.OptionBox1

Case is = 1
Forms!BTDENTRY!BanCovQty.BackColor = RGB(193, 193, 193)
Forms!BTDENTRY!CustCovQty.BackColor = RGB(193, 193, 193)
Forms!BTDENTRY![cus text].SpecialEffect = 0
Forms!BTDENTRY![ban text].SpecialEffect = 0
Forms!BTDENTRY!BanCovQty.Enabled = False
Forms!BTDENTRY!CustCovQty.Enabled = False
Forms!BTDENTRY!BanCovQty.SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.SpecialEffect = 0
Me.Textboxname1.Value = 0
Me.Textboxname2.Value = Null

Case is = 2
Forms!BTDENTRY!CustCovQty.Enabled = True
Forms!BTDENTRY!BanCovQty.Enabled = False
Forms!BTDENTRY!SheetNo.Enabled = False
Forms!BTDENTRY![cus text].SpecialEffect = 1
Forms!BTDENTRY![ban text].SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.SpecialEffect = 2
Forms!BTDENTRY!BanCovQty.SpecialEffect = 0
Forms!BTDENTRY!CustCovQty.BackColor = RGB(230, 30, 70)
Forms!BTDENTRY!BanCovQty.BackColor = RGB(193, 193, 193)
Me!Endsheets.TabStop = No
Me!EndQty.TabStop = No
Me!EndShtSavedFrame.TabStop = No

End Select

You do the above with each possible value in the optionBox. I added the TextboxName to each to give you an example how to change the value of the textbox to Null or 0.

HTH




"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top