| emdiesse |
Apr 7th, 2005 5:11 PM |
Need a bit of help understanding some codes.
Hello. I am useing access to make a database and i need a little bit of help to undestand the codes being used. I have added a few, please change them if they are wrong.
These are the codes. Could someone please help me by going through them and adding comments on each line (like this: 'comment (obviously, lol))
:
Option Compare Database
Private Sub Combo8_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrderID] = " & Str(Nz(Me![Combo8], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub Form_Current()
SubjectsNumber.Requery 'requerys the list of origional subjects
End Sub
:
Option Compare Database
Private Sub Combo36_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrderID] = " & Str(Nz(Me![Combo36], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
:
Option Compare Database
Private Sub Combo41_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrderID] = " & Str(Nz(Me![Combo41], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
:
Option Compare Database
Private Sub cmbCustOrd_Click()
On Error GoTo Err_cmbCustOrd_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustomerOrder"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainMenu", acSaveNo 'Close Main Menu when a button is clicked
Exit_cmbCustOrd_Click:
Exit Sub
Err_cmbCustOrd_Click:
MsgBox Err.Description
Resume Exit_cmbCustOrd_Click
End Sub
Private Sub cmbCancOrd_Click()
On Error GoTo Err_cmbCancOrd_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCancelAnOrder"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainMenu", acSaveNo 'Close Main Menu when a button is clicked
Exit_cmbCancOrd_Click:
Exit Sub
Err_cmbCancOrd_Click:
MsgBox Err.Description
Resume Exit_cmbCancOrd_Click
End Sub
Private Sub cmbAlloSubj_Click()
On Error GoTo Err_cmbAlloSubj_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAllocateSubjects"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainMenu", acSaveNo 'Close Main Menu when a button is clicked
Exit_cmbAlloSubj_Click:
Exit Sub
Err_cmbAlloSubj_Click:
MsgBox Err.Description
Resume Exit_cmbAlloSubj_Click
End Sub
Private Sub cmbManual_Click()
On Error GoTo Err_cmbManual_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmManual"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainMenu", acSaveNo 'Close Main Menu when a button is clicked
Exit_cmbManual_Click:
Exit Sub
Err_cmbManual_Click:
MsgBox Err.Description
Resume Exit_cmbManual_Click
End Sub
Private Sub cmbDatabase_Click()
On Error GoTo Err_cmbDatabase_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAbout"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainMenu", acSaveNo 'Close Main Menu when a button is clicked
Exit_cmbDatabase_Click:
Exit Sub
Err_cmbDatabase_Click:
MsgBox Err.Description
Resume Exit_cmbDatabase_Click
End Sub
Private Sub cmbNotPaid_Click()
On Error GoTo Err_cmbNotPaid_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPaid"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainMenu", acSaveNo 'Close Main Menu when a button is clicked
Exit_cmbNotPaid_Click:
Exit Sub
Err_cmbNotPaid_Click:
MsgBox Err.Description
Resume Exit_cmbNotPaid_Click
End Sub
Private Sub cmbPaid_Click()
On Error GoTo Err_cmbPaid_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPaid"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainMenu", acSaveNo 'Close Main Menu when a button is clicked
Exit_cmbPaid_Click:
Exit Sub
Err_cmbPaid_Click:
MsgBox Err.Description
Resume Exit_cmbPaid_Click
End Sub
:
Option Compare Database
Private Sub Combo32_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrderID] = " & Str(Nz(Me![Combo32], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
:
Option Compare Database
Private Sub Combo32_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrderID] = " & Str(Nz(Me![Combo32], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
:
Option Compare Database
Private Sub Form_BeforeInsert(Cancel As Integer)
If txtCount >= 5 Then
MsgBox "You can only order 5." 'The message to be displayed if customer trys to order >5
Cancel = True 'Cancels the new record event.
End If 'End the if statement
End Sub
Please help. Thanks. It would be helpful if you could add comments for every line of code. Thank you.
|