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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dependent subform?



 
 
Thread Tools Display Modes
  #1  
Old July 2nd, 2009, 10:18 PM posted to microsoft.public.access.forms
Gabe
external usenet poster
 
Posts: 83
Default Dependent subform?

I'm trying to have a subform appear on my main form if a certain value is
selected from a combobox, but I'm having some trouble. I put the following
code in the AfterUpdate field of my combobox but it doesn't work?

Private Sub ServiceTypeSEIU_AfterUpdate(Cancel As Integer)
If Me.ServiceType = "SEIU" Then
Me.SEIU_Only_Query.Form
.Enabled = True
.Visible = True
Else: Me.SEIU_Only_Query.Form
.Enabled = False
.Visable = False
End If
End Sub

Can someone please help?

Thanks,
~Gabe

  #2  
Old July 2nd, 2009, 10:50 PM posted to microsoft.public.access.forms
Arvin Meyer MVP
external usenet poster
 
Posts: 640
Default Dependent subform?

You shouldn't need to enable/disable a subform if you are making it
Visible/Hidden. Is SEIU_Only_Query the actual name of the subform control,
or the subform? You need the name of the control, and you need to leave off
the .Form. Your code should look like:

Private Sub ServiceTypeSEIU_AfterUpdate(Cancel As Integer)
If Me.ServiceType = "SEIU" Then
Me.SEIU_Only_Query.Visible = True
Else
Me.SEIU_Only_Query.Visible = False
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Gabe" wrote in message
...
I'm trying to have a subform appear on my main form if a certain value is
selected from a combobox, but I'm having some trouble. I put the following
code in the AfterUpdate field of my combobox but it doesn't work?

Private Sub ServiceTypeSEIU_AfterUpdate(Cancel As Integer)
If Me.ServiceType = "SEIU" Then
Me.SEIU_Only_Query.Form
.Enabled = True
.Visible = True
Else: Me.SEIU_Only_Query.Form
.Enabled = False
.Visable = False
End If
End Sub

Can someone please help?

Thanks,
~Gabe



  #3  
Old July 2nd, 2009, 10:51 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Dependent subform?

"having some trouble" doesn't give us much to go on ...

(by the way, if you haven't told Access to use an object, it doesn't know
what you are referring to. I usually use the "With" command...)

(by the way, two ... your code appears to be for a control named
"ServiceTypeSEIU", but you test for "ServiceType" = "SEIU". )

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Gabe" wrote in message
...
I'm trying to have a subform appear on my main form if a certain value is
selected from a combobox, but I'm having some trouble. I put the following
code in the AfterUpdate field of my combobox but it doesn't work?

Private Sub ServiceTypeSEIU_AfterUpdate(Cancel As Integer)
If Me.ServiceType = "SEIU" Then
Me.SEIU_Only_Query.Form
.Enabled = True
.Visible = True
Else: Me.SEIU_Only_Query.Form
.Enabled = False
.Visable = False
End If
End Sub

Can someone please help?

Thanks,
~Gabe



  #4  
Old July 2nd, 2009, 11:33 PM posted to microsoft.public.access.forms
Gabe
external usenet poster
 
Posts: 83
Default Dependent subform?

Nevermind I got it. Thanks for all your help though.

~Gabe

"Arvin Meyer MVP" wrote:

You shouldn't need to enable/disable a subform if you are making it
Visible/Hidden. Is SEIU_Only_Query the actual name of the subform control,
or the subform? You need the name of the control, and you need to leave off
the .Form. Your code should look like:

Private Sub ServiceTypeSEIU_AfterUpdate(Cancel As Integer)
If Me.ServiceType = "SEIU" Then
Me.SEIU_Only_Query.Visible = True
Else
Me.SEIU_Only_Query.Visible = False
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Gabe" wrote in message
...
I'm trying to have a subform appear on my main form if a certain value is
selected from a combobox, but I'm having some trouble. I put the following
code in the AfterUpdate field of my combobox but it doesn't work?

Private Sub ServiceTypeSEIU_AfterUpdate(Cancel As Integer)
If Me.ServiceType = "SEIU" Then
Me.SEIU_Only_Query.Form
.Enabled = True
.Visible = True
Else: Me.SEIU_Only_Query.Form
.Enabled = False
.Visable = False
End If
End Sub

Can someone please help?

Thanks,
~Gabe




 




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 08:32 PM.


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