display parameter value

emcf

Member
Local time
Today, 07:05
Joined
Nov 14, 2002
Messages
209
Afternoon All,

Right then.....i have a query which I use to search the database, users click a command button to open up the query and then are prompted to enter the parameter value. The results are then displayed in a form - what I want to do is to display the search term used at the top of the form.

I'm not sure that this is possible and if not, would my best bet be to use a text box on the form and refer to that in the search query?

rgds,
 
re:

Hi,
yes...you will be much more flexabile using unbound controls on your form and refering to them in the query criteria e.g.:

[Forms]![YourForm]![YourControl]

Now you can reference these controls anywhere else to display their value and as many times as you want.
A good setup could be a main form (unbound search controls) and subform (query results).
HTH
Good luck
 
cheers freakazeud,

i'll give that a go, I just wanted to see if i could get it done with the way it is currently set up but probabaly best for me to move away from using paramter queries.

rgds,

euan
 
just knocked it all together......working well, thanks again! i'm going to use such referencing a lot more now.
 
re:

You're welcome.
Glad you got it sorted out.
Good luck on future projects!
 
hi folks,

slight problem with what i have done.....i have set up a text box on a form header for users to search the query on. command button to run the search query once the term has been entered and i also put an 'on enter' event so that the query would run when the the user typed in the term and hit enter.

However, when i opened up the database this morning i tried to click into the text box the search query ran before any term was entered....just clicking the text box seemed to fire off the query. is this what 'on enter' means?...i thought it referred to hitting the enter button.

anyway, any views much appreciated.

rgds,
 
re:

Hi,
the on enter event of a control has NOTHING to do with the keyboard's enter key. This event should be used when you want to execute an action when the user 'enters' the control. It is similar to the on got focus event. I would suggest you use the control's after update event to execute the code. If you want the user to use the keyboard enter key then there are a couple of ways to achieve this. First make sure that 'Enter Key Behavior' property of the search control is set to 'Default'. Then you could add a command button to the form. On that button's on click event add the code to do what you want. Set the command button's 'Default' property to YES. If you know hit the enter key from within anywhere in your form the code behind this buttons on click event will be executed. Another option would be to use the on keypress event of the control to evaluate which key was pressed (vbKeyReturn) and execute your code based on that.
HTH
Good luck
 

Users who are viewing this thread

Back
Top Bottom