Report on combo box result - Important

  • Thread starter Thread starter ReportsRUs
  • Start date Start date
R

ReportsRUs

It is possible to have a combo box look up a record. How
do you get a report of that record printed using a
command button? Reeeally need help on this!!! Need step-
by-step. Thanks.
 
As far as printing a report based on the current record
you could use,
DoCmd.OpenReport "rptDiscipline",acViewPreview, , "[RecordI
D] = " & [RecordID]
This assumes your table has a unique prime key field named
[RecordID] and it is of Number Type.
As far as using a combo box to select a record, the way I
have done it is create a macro, this macro will be called
by the after update event of the combo box. The combo bow
would be based on the data element to be searched/found
let us say LName and we'll name the combobox [FIND].
The macro would contain the following lines:
1. GoToControl
this would relocate the curor from the combo box to the
field on the form containing the data element to be
searched ([LName]).
2. FindRecord
This will find the value of [FIND] we selected in the
conmbobox within the LName field, set the Match to Whole
Field, and set the other properties Match Case - No,
Search - Down, Search as Formatted - No, Only Current
Field - Yes, and Find First - Yes.
3. SetValue
This sets the value of te field [LName] to the search
value [FIND]
4. RunCommand
Enter "Refresh" in the command, so as to refresh the
current form data.

Give this a try, It works for me.
Fons
 
Back
Top