Search facility

G

Guest

I have used the built in 'Find Record' facility behind a command button. The
problem I have is when the form it's on opens, it won't work unless I select
a record in one of the combo boxes. I would prefer that the search button
works without having to do this. Is there a way of getting around this, maybe
telling the search to get the first record up on load or something?

Thanks
 
S

Steve Schapel

KneeDown,

I'm guessing you have an unbound combobox, where you select the record
which you want to "find". Is that right? I'm not sure I entirely
understand the problem. Doesn't the form show a record when it opens?
If not, it is presumably because you have a procedure or macro to tell
it to go to a new record, or else there is no Record Source for the form
when you first open it as it is assigned later somewhere somehow, or
else the Data Entry property of the form is set to Yes, or some other
reason. So, in other words, if all you wnat is for the form to show
that first record in its underlying table/query on opening, you need to
adjust whatever is preventing that from happening now, and the
FindRecord code on the command button is not relevant. If, on the other
hand, there is a specific record you want to have pre-selected on
opening, you could try setting the Default Value of the unbound selector
combobox.

If I have missed the boat here, can you post back with more details of
what you've got there?
 
G

Guest

Thanks Steve,

Ok, not quite but I will try and explain further. I have a form (search)
whose record source is a table - where another form puts the info into.

On this form (search) I have a number of text boxes and one combo - merely
to see the resulting returned info, if there is a better way I'm ok for this
to be changed.

Again, on this form, I have a command button set up to find the records.

On the combo box, if I click it first, select any record and then click the
command button, I can search - however, unless I select first from this combo
box, the search button (command button) gives me an error of "You cannot use
this facility at this moment in time" (or something similar).

It appears the form isn't linking until I make a selection, which for my
users may prove confusing - the whole form is for searching, accessed via the
switchboard.

What I would really like is for the user to be able to search for any aspect
of any record to see its status at any given time (it's for ordering of
goods/services etc).

Ok, think that's it, hopefully explained it a bit better this time. Thanks
very much for your time.
 
S

Steve Schapel

KneeDown,

Are the textboxes and combobox bound or unbound?

Can you post back with the details of the code or macro that is running
on the command button?
 
A

Allen Browne

PMFJI, but I'm thinking that your form is based on a query, and the query
contains criteria that refers to a text box on the form, and this gives you
the chicken'n'egg problem when the form initially loads.

My suggestion would be to remove the criteria from the query so it loads the
records. You can then filter the form based on whatever the user enters.

There's a very-easy-to-setup example you can download and use from this
article:
Find as you type - Filter forms with each keystroke
at:
http://allenbrowne.com/AppFindAsUType.html

It consists of 2 controls:
- a combo where the user chooses what field they want to search;
- a text box where the user enters the value to match.
As they type each character, the form filters to only those records that
match.
Once you copy the 2 controls and code into your database, there is just one
property to set to get it to work on any form.
 

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