Kamis, 16 Mei 2013

[MS_AccessPros] How to - Code A2007

 

Hello everyone,

Am trying to learn how to code, can anyone please put an explanation in plain English,on each line of the below code..

And at same time, please direct me a good link on how learn coding..

Thank you,
zjubias

-------------------
Private Sub cmdIssue_Click()
On Error GoTo trapError
Dim rstLoan As DAO.Recordset
If IsNull(DLookup("StockBarcode", "tblLibraryStock", "StockBarcode = " & Me!txtIssueBarcode)) = True Then
MsgBox "Sorry - Barcode Does Not Exist", vbInformation, "Invalid Barcode"
GoTo leave
Else
Set rstLoan = CurrentDb.OpenRecordset("jnkLoan", dbOpenDynaset)
rstLoan.FindLast "StockBarcodeFK = " & Me!txtIssueBarcode
If rstLoan.NoMatch = False Then
If IsNull(rstLoan!returndate) = True Then
MsgBox "Book Is Already On Loan. Please discharge before Issuing.", vbExclamation, "Already On Loan"
GoTo leave
End If
End If
rstLoan.AddNew
rstLoan!StockBarcodeFK = Me!txtIssueBarcode
rstLoan!UserBarcodeFK = Me!UserBarcode
rstLoan!IssueDate = Date
rstLoan!DueDate = DateAdd("d", 30, Date)
rstLoan.Update
Me!subOnLoan.Requery
Me!txtIssueBarcode = Null
DoCmd.GoToControl "txtissuebarcode"
End If
leave:
If Not rstLoan Is Nothing Then
rstLoan.Close: Set rstLoan = Nothing
End If
Exit Sub
trapError:
MsgBox "Error " & Err.Number & ": " & Error$
Resume leave
End Sub
-------------------

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar