Sub Getmarg(title As String, filename As String)
Dim ssn As New ADODB.Recordset
ssn.Open "select * from report where title='" & title & "' and printer_type='" & PrinterSet & "'", cn
If Not ssn.EOF Then
FrmRpt!Report1.ReportFileName = ReportPath & ssn("filename")
FrmRpt!Report1.MarginLeft = ssn("marginleft")
FrmRpt!Report1.MarginTop = ssn("margintop")
Else
FrmRpt!Report1.ReportFileName = ReportPath & filename
End If
FrmRpt!Report1.Connect = "DSN=" & DsnName & ";UID=" & DatabaseLoginUid & ";PWD=" & DatabaseUserPwd & ";"
ssn.Close: Set ssn = Nothing
End Sub