goof up in a yes/no update field code

G

Guest

I'm trying to make a form with several yes/no update fields and have it
display new fields when one of them are marked yes. However, when I try to
run the code, it tells me that the module is not found. I just developed the
form and put in the code on the after update event on the properties sheet
for the various controls and put the same code in the form's current
property. Is there a step I'm missing? The code is as follows:

Private Sub RSP_AfterUpdate()
If [RSP] = True Then
[TRAINING].Visible
[IET_STATUS].Visible
[RSP_SITE].Visible
[REMARKS].Visible
[SHIP_DATE].Visible
[Label29].Visible
[Label30].Visible
[Label31].Visible
[Label32].Visible
[Label33].Visible
Else
[TRAINING].Visible = False
[IET_STATUS].Visible = False
[RSP_SITE].Visible = False
[REMARKS].Visible = False
[SHIP_DATE].Visible = False
[Label29].Visible = False
[Label30].Visible = False
[Label31].Visible = False
[Label32].Visible = False
[Label33].Visible = False
End If

End Sub

Give me an idea of what I'm doing wrong, if you can. any help would be
appreciated. I'm sorry, I'm just beginning with VB Code.
 
C

Corey-g via AccessMonster.com

I think you need to set the visible property to true, just like you set it
false in the else...

Private Sub RSP_AfterUpdate()
If [RSP] = True Then
[TRAINING].Visible = True
Else
[TRAINING].Visible = False
[IET_STATUS].Visible = False
 
G

George Nicholson

In addition to the other responses you have received, you can simplify your
code a bit and only reference each control once. Makes maintenance easier.:

Dim bolVisible as Boolean

If [RSP] = True Then
bolVisible = True
Else
bolVisible = False
End If

[TRAINING].Visible = bolVisible
[IET_STATUS].Visible = bolVisible
etc...
 
G

Guest

If Me.RSP = "True"

CW

Marshall Barton said:
Corey said:
I'm trying to make a form with several yes/no update fields and have it
display new fields when one of them are marked yes. However, when I try to
run the code, it tells me that the module is not found. I just developed the
form and put in the code on the after update event on the properties sheet
for the various controls and put the same code in the form's current
property. Is there a step I'm missing? The code is as follows:

Private Sub RSP_AfterUpdate()
If [RSP] = True Then
[TRAINING].Visible
[IET_STATUS].Visible
[RSP_SITE].Visible
[REMARKS].Visible
[SHIP_DATE].Visible
[Label29].Visible
[Label30].Visible
[Label31].Visible
[Label32].Visible
[Label33].Visible
Else
[TRAINING].Visible = False
[IET_STATUS].Visible = False
[RSP_SITE].Visible = False
[REMARKS].Visible = False
[SHIP_DATE].Visible = False
[Label29].Visible = False
[Label30].Visible = False
[Label31].Visible = False
[Label32].Visible = False
[Label33].Visible = False
End If

End Sub

Give me an idea of what I'm doing wrong, if you can. any help would be
appreciated. I'm sorry, I'm just beginning with VB Code.


I don't know if it's just the words you are using or
something else, but you can not put code in an event
property.

Event properties can have one of three possible values:
[Event Procedure]
macroname
functionname()
Normally, you would use [Event Procedure] in an event
property. Then you would click on the builder button on the
right side of the property's entry. This will open the VBA
window and place the cursor in the event's procedure between
the Sub and End Sub lines.
 
M

Marshall Barton

Corey said:
I'm trying to make a form with several yes/no update fields and have it
display new fields when one of them are marked yes. However, when I try to
run the code, it tells me that the module is not found. I just developed the
form and put in the code on the after update event on the properties sheet
for the various controls and put the same code in the form's current
property. Is there a step I'm missing? The code is as follows:

Private Sub RSP_AfterUpdate()
If [RSP] = True Then
[TRAINING].Visible
[IET_STATUS].Visible
[RSP_SITE].Visible
[REMARKS].Visible
[SHIP_DATE].Visible
[Label29].Visible
[Label30].Visible
[Label31].Visible
[Label32].Visible
[Label33].Visible
Else
[TRAINING].Visible = False
[IET_STATUS].Visible = False
[RSP_SITE].Visible = False
[REMARKS].Visible = False
[SHIP_DATE].Visible = False
[Label29].Visible = False
[Label30].Visible = False
[Label31].Visible = False
[Label32].Visible = False
[Label33].Visible = False
End If

End Sub

Give me an idea of what I'm doing wrong, if you can. any help would be
appreciated. I'm sorry, I'm just beginning with VB Code.


I don't know if it's just the words you are using or
something else, but you can not put code in an event
property.

Event properties can have one of three possible values:
[Event Procedure]
macroname
functionname()
Normally, you would use [Event Procedure] in an event
property. Then you would click on the builder button on the
right side of the property's entry. This will open the VBA
window and place the cursor in the event's procedure between
the Sub and End Sub lines.
 
G

Guest

Arggg. I'd have taken it back but I couldn't. Sometimes, in the midst of a
submission stuff just happens....

CW

Marshall Barton said:
???


Cheese_whiz said:
If Me.RSP = "True"

CW

Marshall Barton said:
Corey Hite wrote:

I'm trying to make a form with several yes/no update fields and have it
display new fields when one of them are marked yes. However, when I try to
run the code, it tells me that the module is not found. I just developed the
form and put in the code on the after update event on the properties sheet
for the various controls and put the same code in the form's current
property. Is there a step I'm missing? The code is as follows:

Private Sub RSP_AfterUpdate()
If [RSP] = True Then
[TRAINING].Visible
[IET_STATUS].Visible
[RSP_SITE].Visible
[REMARKS].Visible
[SHIP_DATE].Visible
[Label29].Visible
[Label30].Visible
[Label31].Visible
[Label32].Visible
[Label33].Visible
Else
[TRAINING].Visible = False
[IET_STATUS].Visible = False
[RSP_SITE].Visible = False
[REMARKS].Visible = False
[SHIP_DATE].Visible = False
[Label29].Visible = False
[Label30].Visible = False
[Label31].Visible = False
[Label32].Visible = False
[Label33].Visible = False
End If

End Sub

Give me an idea of what I'm doing wrong, if you can. any help would be
appreciated. I'm sorry, I'm just beginning with VB Code.


I don't know if it's just the words you are using or
something else, but you can not put code in an event
property.

Event properties can have one of three possible values:
[Event Procedure]
macroname
functionname()
Normally, you would use [Event Procedure] in an event
property. Then you would click on the builder button on the
right side of the property's entry. This will open the VBA
window and place the cursor in the event's procedure between
the Sub and End Sub lines.
 
M

Marshall Barton

???


Cheese_whiz said:
If Me.RSP = "True"

CW

Marshall Barton said:
Corey said:
I'm trying to make a form with several yes/no update fields and have it
display new fields when one of them are marked yes. However, when I try to
run the code, it tells me that the module is not found. I just developed the
form and put in the code on the after update event on the properties sheet
for the various controls and put the same code in the form's current
property. Is there a step I'm missing? The code is as follows:

Private Sub RSP_AfterUpdate()
If [RSP] = True Then
[TRAINING].Visible
[IET_STATUS].Visible
[RSP_SITE].Visible
[REMARKS].Visible
[SHIP_DATE].Visible
[Label29].Visible
[Label30].Visible
[Label31].Visible
[Label32].Visible
[Label33].Visible
Else
[TRAINING].Visible = False
[IET_STATUS].Visible = False
[RSP_SITE].Visible = False
[REMARKS].Visible = False
[SHIP_DATE].Visible = False
[Label29].Visible = False
[Label30].Visible = False
[Label31].Visible = False
[Label32].Visible = False
[Label33].Visible = False
End If

End Sub

Give me an idea of what I'm doing wrong, if you can. any help would be
appreciated. I'm sorry, I'm just beginning with VB Code.


I don't know if it's just the words you are using or
something else, but you can not put code in an event
property.

Event properties can have one of three possible values:
[Event Procedure]
macroname
functionname()
Normally, you would use [Event Procedure] in an event
property. Then you would click on the builder button on the
right side of the property's entry. This will open the VBA
window and place the cursor in the event's procedure between
the Sub and End Sub lines.
 
M

Marshall Barton

Cheese_whiz said:
Arggg. I'd have taken it back but I couldn't. Sometimes, in the midst of a
submission stuff just happens....

CW


Been there, done that ... many times;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top