Using InputBox or Parameter query wont prompt you with a combo, it will ask
for one value that need to be inputed by the user (not selected from a list),
for that you'll need to create a form (InputBox look alike) with a combo,
when pressing the button open the new form for the user to select a value.
Create a Global variable in a module to assign the value selected to it when
the form is closed
Global MyValue as Number
On the UnLoad event of the new form write
MyValue = Nz(Me.[ComboName],0)
On the Onclick event of the button write the code that open the form, and
then using the value returned
' acDialog will stop the code until the form is closed
Docmd.OpenForm "NewFormName",,,,,acDialog
If MyValue = 0 Then
MsgBox "You need t select a model"
Else
MyCondition = "[FieldNameInTable]=" & MyValue
Docmd.OpenReport "ReportName", , , MyCondition
End If
--
Good Luck
BS"D
Zaheer said:
Thanks Cohen, its really help me. but i dont want to create a combo in the
form, i only want to combo box appear when i press the command button for
report. any idea how to do this
--
Zaheer
Acesss Database Designer
Planning Supervisor
Ofer Cohen said:
In the form where you have a button to open the report create a combo for the
user to select a value before you try to open the report, then try something
like
Dim MyCondition As String
If IsNull(Me.[ComboName]) Then
MsgBox "You need t select a model"
Else
MyCondition = "[FieldNameInTable=" & Me.[ComboName]
Docmd.OpenReport "ReportName", , , MyCondition
End If
Note: If the value passed to the report is a string use
MyCondition = "[FieldNameInTable='" & Me.[ComboName] & "'"
Adding single quote to the string
--
Good Luck
BS"D
:
i need to generate a report after clicking the item in the combo box. e.g i
put a command button on the form for a report. when i click it, a combo box
should appear and i should select a item from it. On the base of selected
item, it should generate a report, e.g i need a report about the car based on
the model. when i click command button for report , a combo box appear with
the different model like toyota , gmc, lexus etc. and and when i click any
model , it should generate the report from the selected model...... i hope
you understand what i want. thanks