Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   Need a bit of help understanding some codes. (http://www.programmingforums.org/showthread.php?t=3190)

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.

Rory Apr 7th, 2005 6:47 PM

I'm not sure I understand what your question is. If you can be more specific on what the problem is / what you want to do we can help.
Thanks
(Are you doing Terry's Turkeys? If not, sorry)

Berto Apr 8th, 2005 2:30 AM

if you are using visual stuudio or soem for or microsoft compiler put the mouse over the function name hit F1 and read the help about it.

Seems odd that you want us to put comments looks like homework you dont understand and so therefore want commenting.

Bharathi Apr 21st, 2005 1:16 AM

Need a bit of help understanding some codes.
 
Hi,

We will tackle one problem at a time. Mention where you want to start.

Regards
Bharathi
Books for developing your own Accounting and Inventory Management Application.
http://www.vkinfotek.com

Rory Apr 21st, 2005 12:05 PM

Please stop digging up old posts!


All times are GMT -5. The time now is 12:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC