Question Access "Find" Window (1 Viewer)

lana

Registered User.
Local time
Today, 10:47
Joined
Feb 10, 2010
Messages
92
Dear All,

As you definitely know and use Access "Find" window, which finds any data you need in any field the focus is....

Did anybody write a code to do the same thing??

I really appreciate any help in this.

Cheers,

LANA
 

lana

Registered User.
Local time
Today, 10:47
Joined
Feb 10, 2010
Messages
92
Thanks for the reply.

Actually no, this is not what I am looking for.

I give an example :

Lets say we have a form with two sub-forms which show two different data sets.
If I go in any one of the fields on the sub-forms then I want to search for one specific data. It should find the data and highlight it on the same sub-form. If there are multiple of the same data, then it should find it one by one. Exactly as the "Find" window in Access does.
I hope someone can give a solution...

Cheers
LANA
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:17
Joined
Sep 12, 2006
Messages
15,632
given a search string

searchfield.setfocus

docmd.findrecord searchstring etc etc - a few arguments to set to control the search.
 

lana

Registered User.
Local time
Today, 10:47
Joined
Feb 10, 2010
Messages
92
Many thanks for the reply.

May be this is very simple for you but is it possible to show me how to do it?

Docmd.findrecord .... is Ok but how do I define the search field?

I have a sub-form which shows the data and I need to search in any field that I set the cursor in.

Really appreciate your time.

Cheers
LANA
 

lana

Registered User.
Local time
Today, 10:47
Joined
Feb 10, 2010
Messages
92
Dear Gemma,

I tried docmd.findrecord on the form and it's fine BUT I need to do this :

When a from is opened and the user goes to specific field (on a sub-form Datasheet) then cliks a "Search" button. A search form opens and asks for a search string. When Search string in entered then it should find the data in the previous form which is already opened and highlits the found item in the sub-form datasheet.

This is done with access "Find" window but I need the codes ...

Sorry to take your time but I really need to do this.
Any help?

Thanks again.

LANA
 

lana

Registered User.
Local time
Today, 10:47
Joined
Feb 10, 2010
Messages
92
Nobody really know how to do this?

Help please.

Really appreciate your time .

LANA
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:17
Joined
Sep 12, 2006
Messages
15,632
I've just said

capture the searchstring the user enters.

set the focus to the field which is to be search

then do

docmd.findrecord

"what" is the searchstring you entered
other parameters are set according to the prompts, generally true and false.
 

lana

Registered User.
Local time
Today, 10:47
Joined
Feb 10, 2010
Messages
92
Thanks again.

I did what you said. It works in one form when I know the form name and the control name, but my problem is something else.

I have 12 forms and in each form I have at least one sub-form which shows the data.
The search form can be opened from each of 12 forms. NOW in the search form how can I know from which form The search form is called i.e. how can I know the name of the form and the last control name which the user wants to search in?

Maybe I cannot explain the problem .......
I hope this is clear.

Cheers
LANA
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:17
Joined
Sep 12, 2006
Messages
15,632
that's a different problem

you could pass in the name of the calling form, using openargs
you could set a public variable to manage the name of the current active form
you may be able to use screen.activeform to identify the calling form
 

Users who are viewing this thread

Top Bottom