Function SetPrt(PrinterID As Integer) As Boolean Dim DB As Database Dim Rs As Recordset Dim SQL As String Dim NazivP As String Dim prtLoop As Printer Set DB = CurrentDb() SQL = "SELECT * FROM Stampaci WHERE Devices='" & PrinterID & "'" Set Rs = DB.OpenRecordset(SQL) NazivP = Rs.Fields(1) For Each prtLoop In Application.Printers With prtLoop If Rs.Fields(1) = .DeviceName Then Set Printer = prtLoop GoTo Kraj End If End With Next prtLoop Kraj: Rs.Close End Function