Macro trouble

tjones

Registered User.
Local time
Today, 11:32
Joined
Jan 17, 2012
Messages
199
I am attempting to have a field hide/visible off the entry of another field using the forms Event macro builder.

If [Type] Like "MP"
SetProperty
Control Name: GDate
Property: Visble
Value: True
Else
Control Name: GDate
Property: Visble
Value: False
EndIf
 
PBaldy, THANK YOU! I changed to VBA and entered it in On Load, On Current, and After Update and it worked perfectly.
 
Sorry, missed the reply. Happy to help! FYI, you don't need it in the load event. The current event runs on load.
 
have another problem I was hoping you could help with. I am trying to open the form with the cmdInternational button hidden. when you select the option button USNo the button appears allowing you access to the international forms.

it's an option group. in the table yes =1 and no=2
it is using the forms design -xyz- option. I tried to post graphic but the forum won't let me. though it does look something like this

| --USCitizen---|
| () Yes | ** this is option button named USYes
| () No | ** this is option button named USNo
-----------------------
with them being round raido option type buttons.

I have tried several different type of code on the "On Current" and then "On Click vs the On Focus" but not combination seems to work. Some of them mess up the other fields you helped me with first.

Any help you can give me would be greatly appreciated. Also how do you add several On currents without messing up the first entries?
 
You should be able to add to the current event without affecting others. You'd have If/Then blocks for each. If you're having trouble, post the code. The other place you'd probably want the code for this is the after update event of the frame.
 
This is what I have

Private Sub Form_Current()
If Me.USNo = ' ' Then
cmdInternational.Visible = True
Else
cmdInternational.Visible = False
End If
End Sub



Private Sub USNo_AfterUpdate()
If Me.USNo = 2 Then
cmdInternational.Visible = True
Else
cmdInternational.Visible = False
End If
End Sub
 
Is USNo the name of the frame or one of the options? You need to test the frame, not the options. The second code looks correct other than that; the first is testing for "" rather than 2.
 
USNo is the name of the option. the frame around the Yes/No options is frmUSCitizen
 
changed the code to

Private Sub Degree_Type_AfterUpdate()
If Me.frmUSCitizen = 2 Then
cmdInternational.Visible = True
Else
cmdInternational.Visible = False
End If
End Sub


Private Sub Form_Current()
If Me.frmUSCitizen = 2 Then *** this was also Me.USNon***
cmdInternational.Visible = True
Else
cmdInternational.Visible = False
End If
End Sub

It is working part way. When the form opens the button is not available, but it is also not showing up when i select the no option. Instead of after update should the second part be "on focus" and should it be the frame or the option?
 
Well, the first bit of code is on the after update event of some other control. It should be in the after update event of frmUSCitizen.
 
Yeah. That did it. I had to After Update on the frame not the form. Thanks!
 
multi-value field

I was wondering if you could help with another post. I entered on under Forms but have gotten on answers. It contains the information and a graphic of the problem.
 

Users who are viewing this thread

Back
Top Bottom