InputBox

  • Thread starter Thread starter Casey Howlett
  • Start date Start date
C

Casey Howlett

Need info please.
I am trying to look up a specific service order so that I can update info
after the job is complete. I am using a OpenForm Macro with a query filter
to do this. Is it possible to use an InputBox from the Where clause to
prompt the user for the service order number, or do I have to design a
seperate form for this. If it is possible could someone show me an example
of the syntax that I would use in the where clause.

TIA
Casey Howlett
 
Casey said:
Need info please.
I am trying to look up a specific service order so that I can update info
after the job is complete. I am using a OpenForm Macro with a query filter
to do this. Is it possible to use an InputBox from the Where clause to
prompt the user for the service order number, or do I have to design a
seperate form for this. If it is possible could someone show me an example
of the syntax that I would use in the where clause.

TIA
Casey Howlett
Casey,
Make a form to display the data.

To use an Input box, you can do it quite easily using some code in the
Click event of a command button on a switchboard.

Dim intOrdernum as Integer
intOrderNum = InputBox("Enter Order#")
DoCmd.OpenForm "FormName",,,"[ServiceOrder] = " & intOrderNum

Add error handling above as needed.
I would not do it that way.

Why not just add a combo box to the form itself.
Only valid Order numbers will be available.
If you use the Combo Wizard to make the box, click on the 3rd option on
the first page of instructions, 'find a record that matches' etc.
Set the combo's 'Auto Expand' property to Yes, and also set the 'Limit
to List' property to Yes.

Enter the order number in the combo box and the record will appear on
the form.

Good Luck.
 
Thanks Fredg

I think I will try it with the combo box. It sounds much easier. I would
really like to learn how to do all this by using VBA though, can you
recommend a good resource for learning how to program VBA?

Thanks
Casey


Fredg said:
Casey said:
Need info please.
I am trying to look up a specific service order so that I can update info
after the job is complete. I am using a OpenForm Macro with a query filter
to do this. Is it possible to use an InputBox from the Where clause to
prompt the user for the service order number, or do I have to design a
seperate form for this. If it is possible could someone show me an example
of the syntax that I would use in the where clause.

TIA
Casey Howlett
Casey,
Make a form to display the data.

To use an Input box, you can do it quite easily using some code in the
Click event of a command button on a switchboard.

Dim intOrdernum as Integer
intOrderNum = InputBox("Enter Order#")
DoCmd.OpenForm "FormName",,,"[ServiceOrder] = " & intOrderNum

Add error handling above as needed.
I would not do it that way.

Why not just add a combo box to the form itself.
Only valid Order numbers will be available.
If you use the Combo Wizard to make the box, click on the 3rd option on
the first page of instructions, 'find a record that matches' etc.
Set the combo's 'Auto Expand' property to Yes, and also set the 'Limit
to List' property to Yes.

Enter the order number in the combo box and the record will appear on
the form.

Good Luck.
 
Is it possible to use an InputBox from the Where clause to
prompt the user for the service order number

Simply use a criterion of

[Enter Service Order number:]

in the Query. No inputbox or code is needed.
 
Back
Top