putting a combo box in a pop-up window

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query in my database that searches for a particular name. I created this query by putting brackets [] into the criteria cell in the query design window. When i run this query a pop-up window appears that says "Enter parameter value". Into the window i have to type the name exactly as it appears in the record. i would like to have a combo box in this pop-up window that would automatically complete the name as i start typing it. Is there anyway to do that, or is there a better way to build my query so that would be possible?
 
Use a form to obtain the desired value and then have the query read the
value from the form.

Replace the parameter in the query with an expression similar to the
following (substitute your real names):

[Forms]![myFormName]![myComboBoxName]

where myFormName is the name of the form and myComboBoxNameis the name of
the combobox that has the desired value.

On your form, put the combo box and a command button. Have the combo box's
Row Source return all the values that you want to select from. Then put code
on the command button's OnClick event to run the query (or to open a report,
if that is what the query will "feed"):

Private Sub CommandButtonName_Click()
DoCmd.OpenQuery "QueryName"
End Sub


or

Private Sub CommandButtonName_Click()
DoCmd.OpenReport "ReportName"
End Sub


--
Ken Snell
<MS ACCESS MVP>



mnance said:
I have a query in my database that searches for a particular name. I
created this query by putting brackets [] into the criteria cell in the
query design window. When i run this query a pop-up window appears that
says "Enter parameter value". Into the window i have to type the name
exactly as it appears in the record. i would like to have a combo box in
this pop-up window that would automatically complete the name as i start
typing it. Is there anyway to do that, or is there a better way to build my
query so that would be possible?
 
I tried the suggestion and am still having problems...

I built a simple database on which to practice. In the
database I have three tables: students (a list of all
students), infractions (a list of all possible
disciplinary infractions), and a table called
studwithinfrac (a table listing students, dates, and
infractions)

I want to be able to print a report called "referral"
when a student has X infractions. This referral should
not include information on any student except the one I
specify.

I created a query called "singstudinfrac". The goal of
the query is generating a list of all the infractions a
particular student has received. This was the query I
originally had [Enter student name] in the criteria line
that prompted the objectionable pop-up window. Now the
criteria line reads: [Forms]![makereferral]![comboname]

"makereferral" is the form that has the combo box and
control button. The combo box named "comboname" is
getting its information from the table that has all
students. The control button has the code:

stDocName = "referral"
DoCmd.OpenReport stDocName, acPreview

All this has eliminated the pop-up window; however, now
my report called "referral" has no information on it.

What am I doing wrong? I feel confident I'm simply
missing a comma or some minor coding problem, but I just
can't find it.

-----Original Message-----
Use a form to obtain the desired value and then have the query read the
value from the form.

Replace the parameter in the query with an expression similar to the
following (substitute your real names):

[Forms]![myFormName]![myComboBoxName]

where myFormName is the name of the form and myComboBoxNameis the name of
the combobox that has the desired value.

On your form, put the combo box and a command button. Have the combo box's
Row Source return all the values that you want to select from. Then put code
on the command button's OnClick event to run the query (or to open a report,
if that is what the query will "feed"):

Private Sub CommandButtonName_Click()
DoCmd.OpenQuery "QueryName"
End Sub


or

Private Sub CommandButtonName_Click()
DoCmd.OpenReport "ReportName"
End Sub


--
Ken Snell
<MS ACCESS MVP>



I have a query in my database that searches for a
particular name. I
created this query by putting brackets [] into the criteria cell in the
query design window. When i run this query a pop-up window appears that
says "Enter parameter value". Into the window i have to type the name
exactly as it appears in the record. i would like to have a combo box in
this pop-up window that would automatically complete the name as i start
typing it. Is there anyway to do that, or is there a better way to build my
query so that would be possible?


.
 
Open the query with the form closed; it'll ask you for the desired value.
Does the query return records if you enter the desired value into the
parameter window?

Is the report bound to the query that you want to use?

Is the combo box's BoundColumn set to the column in the Row Source
table/query that is to hold the value?

Post the SQL of the combo box's Row Source, and identify the bound column of
the combo box.

--
Ken Snell
<MS ACCESS MVP>

mnance said:
I tried the suggestion and am still having problems...

I built a simple database on which to practice. In the
database I have three tables: students (a list of all
students), infractions (a list of all possible
disciplinary infractions), and a table called
studwithinfrac (a table listing students, dates, and
infractions)

I want to be able to print a report called "referral"
when a student has X infractions. This referral should
not include information on any student except the one I
specify.

I created a query called "singstudinfrac". The goal of
the query is generating a list of all the infractions a
particular student has received. This was the query I
originally had [Enter student name] in the criteria line
that prompted the objectionable pop-up window. Now the
criteria line reads: [Forms]![makereferral]![comboname]

"makereferral" is the form that has the combo box and
control button. The combo box named "comboname" is
getting its information from the table that has all
students. The control button has the code:

stDocName = "referral"
DoCmd.OpenReport stDocName, acPreview

All this has eliminated the pop-up window; however, now
my report called "referral" has no information on it.

What am I doing wrong? I feel confident I'm simply
missing a comma or some minor coding problem, but I just
can't find it.

-----Original Message-----
Use a form to obtain the desired value and then have the query read the
value from the form.

Replace the parameter in the query with an expression similar to the
following (substitute your real names):

[Forms]![myFormName]![myComboBoxName]

where myFormName is the name of the form and myComboBoxNameis the name of
the combobox that has the desired value.

On your form, put the combo box and a command button. Have the combo box's
Row Source return all the values that you want to select from. Then put code
on the command button's OnClick event to run the query (or to open a report,
if that is what the query will "feed"):

Private Sub CommandButtonName_Click()
DoCmd.OpenQuery "QueryName"
End Sub


or

Private Sub CommandButtonName_Click()
DoCmd.OpenReport "ReportName"
End Sub


--
Ken Snell
<MS ACCESS MVP>



I have a query in my database that searches for a
particular name. I
created this query by putting brackets [] into the criteria cell in the
query design window. When i run this query a pop-up window appears that
says "Enter parameter value". Into the window i have to type the name
exactly as it appears in the record. i would like to have a combo box in
this pop-up window that would automatically complete the name as i start
typing it. Is there anyway to do that, or is there a better way to build my
query so that would be possible?


.
 
Back
Top