i have 1 code for login and print a daily job for employed
now i have another code to mark a field yes/no if the report already printed
how do i combine those 2 code to one procedure
Code:
Dim rs As Recordset
Set rs=CurrentDb.OpenRecordset("tblimployd",dbOpenSnapshot,dbReadOnly)
rs.FindFirst "username='" & Me.txtusername & "'"
If rs.NoMatch Then
Me.lblWrongUser.Visible = True
Me.txtusername.SetFocus
Exit Sub
End If
Me.lblWrongUser.Visible = False
If rs!password <> Nz(Me.txtpassword, "") Then
Me.lblwrongpass.Visible = True
Me.txtpassword.SetFocus
Exit Sub
End If
Me.lblwrongpass.Visible = False
DoCmd.OpenReport "rpttodo", acViewNormal, , "[operator] = '" & Me.txtusername & "'"
DoCmd.Close acForm, Me.Name
Code:
Private Sub btn334_Click()
DoCmd.PrintOut PrintRange:=acPrintAll, PrintQuality:=acHigh, CollateCopies:=True
Dim rst As RecordsetSet
rst = CurrentDb.OpenRecordset(Name:="qrytodo",Type:=RecordsetTypeEnum.dbOpenDynaset)
Do While Not rst.EOF
CurrentDb.Execute "update qrytodo set printed=true where printed=false"
rst.MoveNext
Loope