I am trying to write a do while loop with various condition how to do that ?
whenever the book barcode is not enter loop
but not the content,
as I have objects inside (recordset)
that will cause runtime error,
if the book barcode is entered the loop the content once.
abridged code ( pseudocode)
how is it possible to do so ?
by doing
do while (me.item.value< >"") or (if a)or (if b)
is so how do you skip the line ?
example 1.
reminders: you don't have to proofread the following code, but just to give you a gist of the various conditions.
the question is
i have many lines, how do i put them
into a syntax format in do while ("condition" ) or ("condition" ) ?
thanks.
whenever the book barcode is not enter loop
but not the content,
as I have objects inside (recordset)
that will cause runtime error,
if the book barcode is entered the loop the content once.
abridged code ( pseudocode)
Code:
do while (me.item.value<>"") if a then do a if b then do b if c then do a and a1 if d then do d and Z if e then do g and h loop
by doing
do while (me.item.value< >"") or (if a)or (if b)
is so how do you skip the line ?
example 1.
reminders: you don't have to proofread the following code, but just to give you a gist of the various conditions.
the question is
i have many lines, how do i put them
into a syntax format in do while ("condition" ) or ("condition" ) ?
thanks.
Code:
If (rsbooks!Status = 2 And rsbooks!LastPatron <> rspatrons!ID) Then
MsgBox "Item cannot be lent, it is on loan"
Me.bookidfrmlend = ""
Me.bookidfrmlend.SetFocus
End If
' check if exceeds quota
If (rsbooks!Status = 1 And rspatrons!quota < rspatrons!quotarule) Then
Dim updatebkstatusonloan As String
Dim updatepatronquota As String
Dim updatelastpatron As String
Me.[checked out to].Value = rspatrons![first name] & " ," & rspatrons![last name]
Me.[BookID] = rsbooks!title
Dim addnewtrans As String
addnewtrans = "INSERT INTO Transactions(BOOKID,[Checked out to])" & _
"VALUES (" & rsbooks!ID & ", " & rspatrons!ID & ")"
DoCmd.SetWarnings False
DoCmd.RunSQL addnewtrans
updatebkstatusonloan = "UPDATE books Set status=2 WHERE Barcode= '" & _
Me.bookidfrmlend.Value & "'"
updatepatronquota = "UPDATE patrons set quota =quota+1 WHERE [Patron Barcode]= '" & _
Me.cmbpbarcode.Value & "'"
updatelastpatron = "UPDATE books set LastPatron = "
updatelastpatron = updatelastpatron & "'" & rspatrons!ID & "'"
updatelastpatron = updatelastpatron & " WHERE id ="
updatelastpatron = updatelastpatron & rsbooks!ID
DoCmd.RunSQL updatebkstatusonloan
DoCmd.RunSQL updatepatronquota
DoCmd.RunSQL updatelastpatron
Me.[DueDate].Value = rstrans![DueDate]
MsgBox rsbooks!title & "Item is Borrowed"
End If
Comment