A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

New form/old table control visibility



 
 
Thread Tools Display Modes
  #1  
Old January 15th, 2009, 12:59 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default 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  
Old January 15th, 2009, 01:19 PM posted to microsoft.public.access.gettingstarted
strive4peace
external usenet poster
 
Posts: 1,670
Default 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  
Old January 15th, 2009, 01:29 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default 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  
Old January 15th, 2009, 02:04 PM posted to microsoft.public.access.gettingstarted
strive4peace
external usenet poster
 
Posts: 1,670
Default 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

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.