RECORDSET

D

DS

I would like to run this code from a recordset.
Any help would be most greatly appreciated.
Thanks
DS


Dim PO As Integer
Dim EMPTI As Integer
Me.TxtNumber = Nz(DMax("PDPrinterID", "tblPrintDetails", "PDCheckID = "
& Me.TxtCheckID), 0)

For PO = 0 To Nz(Me.TxtNumber - 1, 0)
Me.TxtName = Nz(DLookup("PrinterName", "tblPrinters", "PrinterID = " &
Me.TxtNumber), "")
If IsNull(Me.TxtName) Or _
Me.TxtName = "" Then
Me.TxtName = ""
Else:
Set Application.Printer = Application.Printers(Me.TxtName.Value)
DoCmd.OpenReport "rptPrepSlip", , , "PDCheckID = " &
Me.TxtCheckID & " " & _
"And PDPrinterID = " & Me.TxtNumber & ""
Me.TxtNumber = Me.TxtNumber - 1
EMPTI = Nz(DCount("PDPrinterID", "tblPrintDetails", "PDPrinterID =
" & Me.TxtNumber & "AND PDCheckID = " & Me.TxtCheckID), 0)
If IsNull(EMPTI) Or _
EMPTI = 0 Then
Me.TxtNumber = Me.TxtNumber - 1
Else:
End If
Set Application.Printer = Nothing
End If
Next PO
 
B

Bob Hairgrove

I would like to run this code from a recordset.
Any help would be most greatly appreciated.

A recordset is just what it says: a set of records (actually, it is a
cursor if you are familiar with ODBC). As such, it supports nothing to
let you call the code, and no modules to contain it. In other
databases, you can call code from triggers which run when a new row is
inserted, an existing row is deleted, or an update is performed on a
table. Access doesn't support triggers.

You can only run code by calling a function or subroutine. This is
done either by calling a function from a calculated column of a query,
by calling the function in a form or report event procedure (or
control event procedure), by calling a function from a macro, or by
calling it or from another function or subroutine.

That's about it.
Thanks
DS

You're welcome.
 
D

DS

Bob said:
A recordset is just what it says: a set of records (actually, it is a
cursor if you are familiar with ODBC). As such, it supports nothing to
let you call the code, and no modules to contain it. In other
databases, you can call code from triggers which run when a new row is
inserted, an existing row is deleted, or an update is performed on a
table. Access doesn't support triggers.

You can only run code by calling a function or subroutine. This is
done either by calling a function from a calculated column of a query,
by calling the function in a form or report event procedure (or
control event procedure), by calling a function from a macro, or by
calling it or from another function or subroutine.

That's about it.




You're welcome.
So it looks like I don't need it?
ThanksDS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Is This Good? 13
Loop Problem 5
Code Is Slow 3
Code Is Slow 6
Application.Printer 4
Complex If Statement 6
Record not inserting 2
Acc 2007 Subform Recordset vs Acc 2002 Subform Recordset 2

Top