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  

Form_Current() - two statements conflicting?



 
 
Thread Tools Display Modes
  #1  
Old November 12th, 2009, 04:10 PM posted to microsoft.public.access.forms
scottyboyb
external usenet poster
 
Posts: 36
Default Form_Current() - two statements conflicting?

Greetings,

Here is probably a simple puzzle. I have a form with two Form_Current()
events in it. I think one is not playing well with the other. The form has a
command button that opens a subform filtered to the main form's data. That is
working perfectly. I also have an If statement that hides or reveals a text
box based on a check box being true or false. I have this If statement in
another form and it works perfectly there, but here the form opens with the
text box visible with the check both false. I think it has to do with the
Form_Current_Exit: and Exit Sub lines in the code. Am I correct and if so
what do I do about it? If I am not correct, then does anyone have a suggstion
of what might be wrong? If I am wrong, will I need to post the rest of the
form's code for the ChildForm opening and closing and filtering?

Thanks,
Scott

Here is the code for Form_Current():

Sub Form_Current()

On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm
Form_Current_Exit:
Exit Sub

If Me!chkBoardMember = False Then
Me!txtPosition.Visible = False
Me!txtPosition.Value = ""
Else
Me!txtPosition.Visible = True
End If

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
  #2  
Old November 12th, 2009, 04:25 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default Form_Current() - two statements conflicting?

Your If statment is never going to process because you're
exiting the procedure before you ever get there. Move these
lines

Form_Current_Exit:
Exit Sub

further down in the procedure (before the error handler)

Sub Form_Current()

On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

If Me!chkBoardMember = False Then
Me!txtPosition.Visible = False
Me!txtPosition.Value = ""
Else
Me!txtPosition.Visible = True
End If

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub

--
_________

Sean Bailey


"scottyboyb" wrote:

Greetings,

Here is probably a simple puzzle. I have a form with two Form_Current()
events in it. I think one is not playing well with the other. The form has a
command button that opens a subform filtered to the main form's data. That is
working perfectly. I also have an If statement that hides or reveals a text
box based on a check box being true or false. I have this If statement in
another form and it works perfectly there, but here the form opens with the
text box visible with the check both false. I think it has to do with the
Form_Current_Exit: and Exit Sub lines in the code. Am I correct and if so
what do I do about it? If I am not correct, then does anyone have a suggstion
of what might be wrong? If I am wrong, will I need to post the rest of the
form's code for the ChildForm opening and closing and filtering?

Thanks,
Scott

Here is the code for Form_Current():

Sub Form_Current()

On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm
Form_Current_Exit:
Exit Sub

If Me!chkBoardMember = False Then
Me!txtPosition.Visible = False
Me!txtPosition.Value = ""
Else
Me!txtPosition.Visible = True
End If

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub

  #3  
Old November 12th, 2009, 05:09 PM posted to microsoft.public.access.forms
scottyboyb
external usenet poster
 
Posts: 36
Default Form_Current() - two statements conflicting?

Thank you, that's the ticket. I did not know I could move those pieces around
like that.

Best,
Scott

"Beetle" wrote:

Your If statment is never going to process because you're
exiting the procedure before you ever get there. Move these
lines

Form_Current_Exit:
Exit Sub

further down in the procedure (before the error handler)

Sub Form_Current()

On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

If Me!chkBoardMember = False Then
Me!txtPosition.Visible = False
Me!txtPosition.Value = ""
Else
Me!txtPosition.Visible = True
End If

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub

--
_________

Sean Bailey


"scottyboyb" wrote:

Greetings,

Here is probably a simple puzzle. I have a form with two Form_Current()
events in it. I think one is not playing well with the other. The form has a
command button that opens a subform filtered to the main form's data. That is
working perfectly. I also have an If statement that hides or reveals a text
box based on a check box being true or false. I have this If statement in
another form and it works perfectly there, but here the form opens with the
text box visible with the check both false. I think it has to do with the
Form_Current_Exit: and Exit Sub lines in the code. Am I correct and if so
what do I do about it? If I am not correct, then does anyone have a suggstion
of what might be wrong? If I am wrong, will I need to post the rest of the
form's code for the ChildForm opening and closing and filtering?

Thanks,
Scott

Here is the code for Form_Current():

Sub Form_Current()

On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm
Form_Current_Exit:
Exit Sub

If Me!chkBoardMember = False Then
Me!txtPosition.Visible = False
Me!txtPosition.Value = ""
Else
Me!txtPosition.Visible = True
End If

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub

 




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:53 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.