0% found this document useful (0 votes)
13 views4 pages

Code 2

The document contains code for validating login credentials and toggling label colors on a timer. It includes subroutines for handling clicks on command buttons to check for required fields and open a report on submit.

Uploaded by

LGUTANAY RIZAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views4 pages

Code 2

The document contains code for validating login credentials and toggling label colors on a timer. It includes subroutines for handling clicks on command buttons to check for required fields and open a report on submit.

Uploaded by

LGUTANAY RIZAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Private Sub Command1_Click()

If IsNull(Me.txtLoginID) Then

MsgBox "Please enter LoginID", vbInformation, "LoginID Required"

Me.txtLoginID.SetFocus

ElseIf IsNull(Me.txtPassword) Then

MsgBox "Please enter password", vbInformation, "Password Required"

Me.txtPassword.SetFocus

Else

'process the job

If (IsNull(DLookup("UserLogin", "tblUser", "UserLogin ='" & Me.txtLoginID.Value & "'"))) Or _

(IsNull(DLookup("password", "tblUser", "Password ='" & Me.txtPassword.Value & "'"))) Then

MsgBox "Incorrect LoginID or Password"

Else

MsgBox "LoginID or Password correct"

End If

End If

End Sub

==================

Private Sub Form_Timer()

With blinkingLabel

.ForeColor = (IIf(.ForeColor = -2147483640, -2147483633, -2147483640))

End With

End Sub
With Me.Alert

'If the color is black, the color is red otherwise the color is black!

.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))

End With

End Sub

Private Sub Command2_Click()

Dim stDocName As String

If IsNull(Me.byDate) Then

MsgBox "Date not Entered.", vbInformation, "No Date Information"

Me.byDate.SetFocus

Me.Label1.ForeColor = vbRed 'initially set label to Red

Me.Form.TimerInterval = 500 'set Timer interval to 500 milliseconds

Else

Me.Label1.ForeColor = vbBlack

Me.Form.TimerInterval = 0 'set Timer back to 0 Millisecond if byDate is not Null

stDocName = "rpt one" 'if date is not null then open report

DoCmd.OpenReport stDocName, acPreview

End If

End Sub
Private Sub Form_Timer()

If Me.Label1.ForeColor = vbRed Then

Me.Label1.ForeColor = vbYellow

Else

Me.Label1.ForeColor = vbRed

End If

End Sub

=[QTY2]*[UCOST2]

Private Sub TOTBAL_BeforeUpdate(Cancel As Integer)

If IsNullMe.TOTBAL.Value "5")

Me.TOTBAL.SetFocus

Me.TOTBAL.ForeColor = vbRed 'initially set label to Red

Me.Form.TimerInterval = 500 'set Timer interval to 500 milliseconds

Else

Me.Label1.ForeColor = vbBlack

Me.Form.TimerInterval = 500 'set Timer back to 0 Millisecond if byDate is not Null

End Sub

=Nz([UNITCOST],0)*1*Nz([JAN],0)*1+Nz([FEB],0)*1+Nz([MAR],0)*1+Nz([APR],0)*1+Nz([MAY],0)*1+Nz([J
UN],0)*1+Nz([JUL],0)*1+Nz([AUG],0)*1+Nz([SEP],0)*1+Nz([OCT],0)*1+Nz([NOV],0)*1+Nz([DEC],0)*1
=[UNITCOST]*(Nz([JAN],0)*1+Nz([FEB],0)*1+Nz([MAR],0)*1+Nz([APR],0)*1+Nz([MAY],0)*1+Nz([JUN],0)*
1+Nz([JUL],0)*1+Nz([AUG],0)*1+Nz([SEP],0)*1+Nz([OCT],0)*1+Nz([NOV],0)*1+Nz([DEC],0)*1)

You might also like