hi, ok i need a bit of help with visual basic in access, i have written the code etc with the help of a family friend who is now away out of the country for the time being so he can't help.
ok so here's my problem:
all my code is written etc but just found out on friday that every line of the code needs to be annotated specifying what it does etc and i mean EVERY line but seeing as i'm not that familiar with VBA i don't know what each little object does but know what each page of code does so i was wonderin if u guys cud annotate the code for me in BASIC terms plz it wud be much appreciated
here's the codes:
1.
Private Sub Quantity_LostFocus()
If CDbl(Quantity.Value) > CDbl([Amount in stock].Value) Then
MsgBox "Only " & [Amount in stock].Value & " in stock !!"
Quantity.Value = Quantity.OldValue
Exit Sub
End If
[Item Value].Value = CDbl(Quantity.Value) * CDbl([Selling Price].Value)
End Sub
2.
Private Sub lstProducts_DblClick(Cancel As Integer)
Dim dblItemValue As Double
Dim strSQL As String
Dim lngTransFK As Long
Dim lngProductFK As Long
Dim lngQuantity As Long
lngProductFK = lstProducts.Column(0)
lngTransFK = Forms![frm_Transactions].txtTransID.Value
If CLng(lstProducts.Column(3)) = 0 Then Exit Sub
lngQuantity = 1
dblItemValue = CDbl(lstProducts.Column(2))
strSQL = "INSERT INTO tbl_transprod (TransactionFK, ProductFK, Quantity, TransactionValue) VALUES (" _
& lngTransFK & ", " & lngProductFK & "," & lngQuantity & ", " & dblItemValue & ")"
CurrentDb().Execute strSQL
Forms![frm_Transactions].subfrm_transprod.Requery
End Sub
3.
Private Sub txtDesc_Change()
Dim strRowSource As String
Dim strDesc As String
strRowSource = "SELECT [ID], [Product Description], [Selling Price], [Amount in Stock] FROM tbl_products"
strDesc = Trim(txtDesc.Text)
If Len(strDesc) > 0 Then
strRowSource = strRowSource & " WHERE [Product Description] LIKE ""*" & strDesc & "*"""
End If
lstProducts.RowSource = strRowSource
lstProducts.Requery
End Sub
if u cud do annotations in a different colour plz, hope it's not too much to ask but is very important