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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
New form/old table control visibility
I'm designing a new form for an existing table. I need to program certain
areas to be visible or invisible, based on a check box or text box within the form. The problem is that if I use the AfterUpdate event, the existing records don't act accordingly (since their controls/data were previously updated). Is there another event I can use that depends on whether or not a box is empty or filled? Or can I programmatically refer back to the table field? Currently my code looks like this: Private Sub chkPaybackApproved_AfterUpdate() If Me.chkPaybackApproved = True Then Me.cboApprBy.Visible = True Else Me.cboApprBy.Visible = False End If End Sub Private Sub Form_Current() If Me.chkPaybackApproved = True Then Me.cboApprBy.Visible = True Else Me.cboApprBy.Visible = False End If End Sub Again, this works fine for new records. But existing ones stay hidden. Thanks for your time!! -- GD |
#2
|
|||
|
|||
New form/old table control visibility
to set things according to existing records, the Current event should be
the one to use... and you may want to test for Me.NewRecord=true in the Current event since it won't have a value to compare if a control influences something, then the control AfterUpdate event should also be used -- so you seem to be doing everything right .... what is the problem? Warm Regards, Crystal remote programming and training Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace * (: have an awesome day * GD wrote: I'm designing a new form for an existing table. I need to program certain areas to be visible or invisible, based on a check box or text box within the form. The problem is that if I use the AfterUpdate event, the existing records don't act accordingly (since their controls/data were previously updated). Is there another event I can use that depends on whether or not a box is empty or filled? Or can I programmatically refer back to the table field? Currently my code looks like this: Private Sub chkPaybackApproved_AfterUpdate() If Me.chkPaybackApproved = True Then Me.cboApprBy.Visible = True Else Me.cboApprBy.Visible = False End If End Sub Private Sub Form_Current() If Me.chkPaybackApproved = True Then Me.cboApprBy.Visible = True Else Me.cboApprBy.Visible = False End If End Sub Again, this works fine for new records. But existing ones stay hidden. Thanks for your time!! |
#3
|
|||
|
|||
New form/old table control visibility
The problem is that the existing records appear in the form with check boxes
checked, but the areas that are supposed to become visible don't, unless the check box is unchecked, then checked again (i.e. updated). I don't see a Current event for anything but the form. Should I be entering my code in this event only? If so can you give me a generic example? Thanks!! -- GD "strive4peace" wrote: to set things according to existing records, the Current event should be the one to use... and you may want to test for Me.NewRecord=true in the Current event since it won't have a value to compare if a control influences something, then the control AfterUpdate event should also be used -- so you seem to be doing everything right .... what is the problem? Warm Regards, Crystal remote programming and training Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace * (: have an awesome day * GD wrote: I'm designing a new form for an existing table. I need to program certain areas to be visible or invisible, based on a check box or text box within the form. The problem is that if I use the AfterUpdate event, the existing records don't act accordingly (since their controls/data were previously updated). Is there another event I can use that depends on whether or not a box is empty or filled? Or can I programmatically refer back to the table field? Currently my code looks like this: Private Sub chkPaybackApproved_AfterUpdate() If Me.chkPaybackApproved = True Then Me.cboApprBy.Visible = True Else Me.cboApprBy.Visible = False End If End Sub Private Sub Form_Current() If Me.chkPaybackApproved = True Then Me.cboApprBy.Visible = True Else Me.cboApprBy.Visible = False End If End Sub Again, this works fine for new records. But existing ones stay hidden. Thanks for your time!! |
#4
|
|||
|
|||
New form/old table control visibility
The Current event is triggered when you move to a different record --
and it is at the form level. If the form is not bound to a RecordSource, this event does not happen. Can you describe the data used for your form and subforms? ie: Main form: RecordSource? (what is the tablename or SQL statement?) subform1: Name? LinkMasterFields? LinkChildFields? RecordSource? etc... what are the sections that you are hiding and showing and why? Warm Regards, Crystal remote programming and training Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace * (: have an awesome day * GD wrote: The problem is that the existing records appear in the form with check boxes checked, but the areas that are supposed to become visible don't, unless the check box is unchecked, then checked again (i.e. updated). I don't see a Current event for anything but the form. Should I be entering my code in this event only? If so can you give me a generic example? Thanks!! |
Thread Tools | |
Display Modes | |
|
|