searching from a form

G

Guest

Hi,

I'm really struggling with the process of setting my query criteria via a
form. I'm essentially trying to combine 3 query parameter dialogs into 1
form. I've tried everything, macros - hit search button, openQuery etc.
code - Me.Visible = False
DoCmd.OpenQuery "qryByExperience",
acViewNormal, acEdit
DoCmd.Close acForm, "frmSearch"

These are on the onClick event of my search form.

Within the query i'm using the following format within the criteria rows,
Forms![FormName]![ControlName]

I'm able to open the query, but get no results. I know the matching records
are there, and if I run the query and handle each query parameter 1 by 1 I
get the desired results.

I'm missing something but don't know what. The form uses combo boxes that
utilise the lookup wizard lookup. I've run through Microsoft's examples with
theirnorthwind db but am even struggling with that. Are there any settings I
could have wrong?

Hope someone can help, fingers tightly crossed,

Rob
 
G

Guest

Hi, Rob.

I *think*, from what you've said, that you're trying to apply a filter to a
recordset on a form based on one or more criteria you've provided on a form.
Is this correct? And if so, is the criteria entered to be matched exactly or
as a wildcard? For example, if you provide combo boxes limited to list, the
user will only be able to select amongst the previously entered items, but if
you provide a CustomerName textbox, and intend that the query return any
partial match, that's something different.

Please post your intention and I can help.

Sprinks
 
G

Guest

Hi,

I'm aiming to use the form purely as a method of providing the user with the
required search criteria. By using the 3 combo boxes (limited to list) I
want to provide them with the defined areas on which they can search, rather
than just let them search on anything.

Via this form I'm trying to 'feed' my query with 3 criteria on which to
search, after hitting a 'Search' or 'OK' cmd button.

Hopes this helps define the problem,

Thanks Spinks

Sprinks said:
Hi, Rob.

I *think*, from what you've said, that you're trying to apply a filter to a
recordset on a form based on one or more criteria you've provided on a form.
Is this correct? And if so, is the criteria entered to be matched exactly or
as a wildcard? For example, if you provide combo boxes limited to list, the
user will only be able to select amongst the previously entered items, but if
you provide a CustomerName textbox, and intend that the query return any
partial match, that's something different.

Please post your intention and I can help.

Sprinks


Rob Parsons said:
Hi,

I'm really struggling with the process of setting my query criteria via a
form. I'm essentially trying to combine 3 query parameter dialogs into 1
form. I've tried everything, macros - hit search button, openQuery etc.
code - Me.Visible = False
DoCmd.OpenQuery "qryByExperience",
acViewNormal, acEdit
DoCmd.Close acForm, "frmSearch"

These are on the onClick event of my search form.

Within the query i'm using the following format within the criteria rows,
Forms![FormName]![ControlName]

I'm able to open the query, but get no results. I know the matching records
are there, and if I run the query and handle each query parameter 1 by 1 I
get the desired results.

I'm missing something but don't know what. The form uses combo boxes that
utilise the lookup wizard lookup. I've run through Microsoft's examples with
theirnorthwind db but am even struggling with that. Are there any settings I
could have wrong?

Hope someone can help, fingers tightly crossed,

Rob
 
G

Guest

Hi,

I've got the form working with a couple of filters, with the criteria being
entered into txt boxes. It would be good if I could use combo boxes instead.
I thought it would be a simple matter of changing the code to reference the
cbo boxes rather than the txt boxes, unfortunately this doesn't seem to be
the case.

.....
DoCmd.ApplyFilter , "[PT_ProjectType] = '" & Me.txtProject & "'"
DoCmd.ApplyFilter , "[BT_BuildingType] = '" & Me.txtBuilding & "'"
.....

Any ideas on what I'm missing? Very new to this and all help is much
appreciated.

Thanks, Rob
Sprinks said:
Hi, Rob.

I *think*, from what you've said, that you're trying to apply a filter to a
recordset on a form based on one or more criteria you've provided on a form.
Is this correct? And if so, is the criteria entered to be matched exactly or
as a wildcard? For example, if you provide combo boxes limited to list, the
user will only be able to select amongst the previously entered items, but if
you provide a CustomerName textbox, and intend that the query return any
partial match, that's something different.

Please post your intention and I can help.

Sprinks


Rob Parsons said:
Hi,

I'm really struggling with the process of setting my query criteria via a
form. I'm essentially trying to combine 3 query parameter dialogs into 1
form. I've tried everything, macros - hit search button, openQuery etc.
code - Me.Visible = False
DoCmd.OpenQuery "qryByExperience",
acViewNormal, acEdit
DoCmd.Close acForm, "frmSearch"

These are on the onClick event of my search form.

Within the query i'm using the following format within the criteria rows,
Forms![FormName]![ControlName]

I'm able to open the query, but get no results. I know the matching records
are there, and if I run the query and handle each query parameter 1 by 1 I
get the desired results.

I'm missing something but don't know what. The form uses combo boxes that
utilise the lookup wizard lookup. I've run through Microsoft's examples with
theirnorthwind db but am even struggling with that. Are there any settings I
could have wrong?

Hope someone can help, fingers tightly crossed,

Rob
 

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