Hi All,
I have a report that works flawlessly when a user runs it and enters the specific job number they want the report on. What I'd like to do now is allow the user to run a batch of these reports by Client. (Clients own the Jobs). In order to do this, I created a form in which the user selects the printer, the client, and which report they want to run in the batch. They can click a run button that is supposed to automate this process, grabbing all of the relevant job numbers and then running through the recordset, auto-completing the form for the user. However, the form never seems to receive the code. The form contains one ComboBox which is unbound.
rst!Job is the field that is quivalent to the JobNoID field that the cbobox is bound to, the number the user sees in the cbobox is a more friendly job number. The cbobox is getting the two fields from a query of a sql server table.
Hopefully I covered everything.
Garrett
I have a report that works flawlessly when a user runs it and enters the specific job number they want the report on. What I'd like to do now is allow the user to run a batch of these reports by Client. (Clients own the Jobs). In order to do this, I created a form in which the user selects the printer, the client, and which report they want to run in the batch. They can click a run button that is supposed to automate this process, grabbing all of the relevant job numbers and then running through the recordset, auto-completing the form for the user. However, the form never seems to receive the code. The form contains one ComboBox which is unbound.
Code:
Dim RptNm As String
Dim PrtNm As String
Dim Rpt As Report
Dim Prt As Printer
Dim rst As DAO.Recordset
Dim strFilter As String
Dim WAIT As Double
RptNm = Me.cboReport
PrtNm = Me.cboPrinter
Set rst = CurrentDb.OpenRecordset("SELECT Job FROM JobDataBATCH WHERE ClientID=" & Me.ClientID)
If rst.BOF And rst.EOF Then
MsgBox ("No Records Found")
Else
rst.MoveFirst
Set Prt = Application.Printers(PrtNm)
Set Application.Printer = Prt
Do While Not rst.EOF
DoCmd.openReport RptNm, acViewNormal
Forms!JobLkUp.CoJob.SetFocus
Forms!JobLkUp.CoJob = rst!Job
Call byjob_OK
WAIT = Timer
While Timer < WAIT + 2
DoEvents
Wend
rst.MoveNext
Loop
End If
rst.Close
rst!Job is the field that is quivalent to the JobNoID field that the cbobox is bound to, the number the user sees in the cbobox is a more friendly job number. The cbobox is getting the two fields from a query of a sql server table.
Hopefully I covered everything.
Garrett