dbTalk Databases Forums  

bound control causes "Enter Parameter Value" pop-up on form close

comp.database.ms-access comp.database.ms-access


Discuss bound control causes "Enter Parameter Value" pop-up on form close in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mike Easter
 
Posts: n/a

Default bound control causes "Enter Parameter Value" pop-up on form close - 08-09-2004 , 04:59 PM






I have two combo boxes on a form, both bound to a field in the table.
They're named input_Section and input_Category. Both fields have queries as
their data source. Categories are a subset of Section, so I want the
input_Category combo box to display only categories relevant to the
selected section. Therefore, the query underlying the input_Category combo
box uses input_Section = [Forms]![frm_Input]![input_Section] to select
categories.

It works fine, but when I close the form using DoCmd.Close, an "Enter
Parameter Value" pop-up appears asking the end-user to enter a value for
[Forms]![frm_Input]![input_Section]. I guess on closing the form loses the
value of input_Section and interprets the field reference as a parameter.
Is there any way of preventing this? I notice when I close the form using
the control box this message doesn't appear. If there's a solution easier
than creating an unbound control I'd love to try that.

Any help appreciated!

Mike

Reply With Quote
  #2  
Old   
David Thomas
 
Posts: n/a

Default Re: bound control causes "Enter Parameter Value" pop-up on form close - 08-16-2004 , 10:56 PM






Hi Mike,

I think the solution to your problem may be to store the value of
[Forms]![frm_Input]![input_Section] locally in a global variable
inside the form.

A global variable is declared at the head of the code module, before
the functions or procedures. You can also make it public, so it is
available to other modules.

e.g Public strSection as String

You could set the value after the update of the section combo box, or
when the form has loaded and populate the categories accordingly.
That way the value of input_Section will still be registered when you
close the form.
You could refer to the variable in the source query...

I actually use this method for reports sometimes. I use an inputbox()
to get user data on the report_open() event. for example, the month
they want... I store the users response in a public global variable
and refer to it in the report source query as [some field] =
[reports]![myReport]![myGlobalPublicString]

May be a bit of a hack, but it works!

hope it helps,

David Thomas.

Mike Easter <oikoi (AT) hotmail (DOT) com> wrote

Quote:
I have two combo boxes on a form, both bound to a field in the table.
They're named input_Section and input_Category. Both fields have queries as
their data source. Categories are a subset of Section, so I want the
input_Category combo box to display only categories relevant to the
selected section. Therefore, the query underlying the input_Category combo
box uses input_Section = [Forms]![frm_Input]![input_Section] to select
categories.

It works fine, but when I close the form using DoCmd.Close, an "Enter
Parameter Value" pop-up appears asking the end-user to enter a value for
[Forms]![frm_Input]![input_Section]. I guess on closing the form loses the
value of input_Section and interprets the field reference as a parameter.
Is there any way of preventing this? I notice when I close the form using
the control box this message doesn't appear. If there's a solution easier
than creating an unbound control I'd love to try that.

Any help appreciated!

Mike

Reply With Quote
  #3  
Old   
David Thomas
 
Posts: n/a

Default Re: bound control causes "Enter Parameter Value" pop-up on form close - 08-16-2004 , 10:56 PM



Hi Mike,

I think the solution to your problem may be to store the value of
[Forms]![frm_Input]![input_Section] locally in a global variable
inside the form.

A global variable is declared at the head of the code module, before
the functions or procedures. You can also make it public, so it is
available to other modules.

e.g Public strSection as String

You could set the value after the update of the section combo box, or
when the form has loaded and populate the categories accordingly.
That way the value of input_Section will still be registered when you
close the form.
You could refer to the variable in the source query...

I actually use this method for reports sometimes. I use an inputbox()
to get user data on the report_open() event. for example, the month
they want... I store the users response in a public global variable
and refer to it in the report source query as [some field] =
[reports]![myReport]![myGlobalPublicString]

May be a bit of a hack, but it works!

hope it helps,

David Thomas.

Mike Easter <oikoi (AT) hotmail (DOT) com> wrote

Quote:
I have two combo boxes on a form, both bound to a field in the table.
They're named input_Section and input_Category. Both fields have queries as
their data source. Categories are a subset of Section, so I want the
input_Category combo box to display only categories relevant to the
selected section. Therefore, the query underlying the input_Category combo
box uses input_Section = [Forms]![frm_Input]![input_Section] to select
categories.

It works fine, but when I close the form using DoCmd.Close, an "Enter
Parameter Value" pop-up appears asking the end-user to enter a value for
[Forms]![frm_Input]![input_Section]. I guess on closing the form loses the
value of input_Section and interprets the field reference as a parameter.
Is there any way of preventing this? I notice when I close the form using
the control box this message doesn't appear. If there's a solution easier
than creating an unbound control I'd love to try that.

Any help appreciated!

Mike

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.