help me ( codes)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • firozfasilan
    New Member
    • Feb 2007
    • 42

    #1

    help me ( codes)

    please explain the following code to me
    I want to know in detail would you help me?



    Public Function MnuUpload()
    Screen.MousePoi nter = 11
    mI = ExecuteSQL("DEL ETE FROM SCMnuElements WHERE IDModu='" & Mid(App.Title, 1, 2) & "'")
    Set aRS = GetRSLoaded("SC MnuElements")
    Dim xStri As String
    Dim FormCtrl As Control
    For Each FormCtrl In FrmXX
    With FormCtrl
    If TypeOf FormCtrl Is Menu Then
    If Len(FormCtrl.Na me) = 13 Then
    vStri = FormCtrl.Captio n
    xStri = ""
    For mI = 1 To Len(vStri)
    If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
    Next
    vInti = pfGetNextID("SC MnuElements", "RecNbr", "")
    aRS.AddNew
    aRS![RecNbr] = vInti
    aRS![IDModu] = UCase(Mid(App.T itle, 1, 2))
    aRS![NameMo] = App.FileDescrip tion
    aRS![IDMenu] = FormCtrl.Name
    aRS![NameMn] = xStri
    aRS.Update
    End If
    End If
    End With
    Next
    Screen.MousePoi nter = 0
    MsgBox "Menu Elements Up-Load is Done !", vbInformation, App.FileDescrip tion
    End Function
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by firozfasilan
    please explain the following code to me
    I want to know in detail would you help me?



    Public Function MnuUpload()
    Screen.MousePoi nter = 11
    mI = ExecuteSQL("DEL ETE FROM SCMnuElements WHERE IDModu='" & Mid(App.Title, 1, 2) & "'")
    Set aRS = GetRSLoaded("SC MnuElements")
    Dim xStri As String
    Dim FormCtrl As Control
    For Each FormCtrl In FrmXX
    With FormCtrl
    If TypeOf FormCtrl Is Menu Then
    If Len(FormCtrl.Na me) = 13 Then
    vStri = FormCtrl.Captio n
    xStri = ""
    For mI = 1 To Len(vStri)
    If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
    Next
    vInti = pfGetNextID("SC MnuElements", "RecNbr", "")
    aRS.AddNew
    aRS![RecNbr] = vInti
    aRS![IDModu] = UCase(Mid(App.T itle, 1, 2))
    aRS![NameMo] = App.FileDescrip tion
    aRS![IDMenu] = FormCtrl.Name
    aRS![NameMn] = xStri
    aRS.Update
    End If
    End If
    End With
    Next
    Screen.MousePoi nter = 0
    MsgBox "Menu Elements Up-Load is Done !", vbInformation, App.FileDescrip tion
    End Function

    if you keepon posting bulk coding its dificult to track it

    first u explain what u r looking for and wahats your problem... baby

    Comment

    • firozfasilan
      New Member
      • Feb 2007
      • 42

      #3
      Originally posted by hariharanmca
      if you keepon posting bulk coding its dificult to track it

      first u explain what u r looking for and wahats your problem... baby

      I want to know the techniques used in this codes
      please give me the explantions of the code.

      i am in little trouble in getting with the database programming.

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #4
        Originally posted by firozfasilan
        please explain the following code to me
        I want to know in detail would you help me?



        Public Function MnuUpload()
        Screen.MousePoi nter = 11
        mI = ExecuteSQL("DEL ETE FROM SCMnuElements WHERE IDModu='" & Mid(App.Title, 1, 2) & "'")
        Set aRS = GetRSLoaded("SC MnuElements")
        Dim xStri As String
        Dim FormCtrl As Control
        For Each FormCtrl In FrmXX
        With FormCtrl
        If TypeOf FormCtrl Is Menu Then
        If Len(FormCtrl.Na me) = 13 Then
        vStri = FormCtrl.Captio n
        xStri = ""
        For mI = 1 To Len(vStri)
        If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
        Next
        vInti = pfGetNextID("SC MnuElements", "RecNbr", "")
        aRS.AddNew
        aRS![RecNbr] = vInti
        aRS![IDModu] = UCase(Mid(App.T itle, 1, 2))
        aRS![NameMo] = App.FileDescrip tion
        aRS![IDMenu] = FormCtrl.Name
        aRS![NameMn] = xStri
        aRS.Update
        End If
        End If
        End With
        Next
        Screen.MousePoi nter = 0
        MsgBox "Menu Elements Up-Load is Done !", vbInformation, App.FileDescrip tion
        End Function
        1. set screen mouse pointer to HourGlass
        2 Delete Record from SCMnuElements WHERE IDModu='" & Mid(App.Title, 1, 2) & "'
        3 loding records in aRs

        For Each FormCtrl In FrmXX
        With FormCtrl
        If TypeOf FormCtrl Is Menu Then
        If Len(FormCtrl.Na me) = 13 Then
        vStri = FormCtrl.Captio n
        xStri = ""
        For mI = 1 To Len(vStri)
        If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
        Next
        vInti = pfGetNextID("SC MnuElements", "RecNbr", "")
        aRS.AddNew
        aRS![RecNbr] = vInti
        aRS![IDModu] = UCase(Mid(App.T itle, 1, 2))
        aRS![NameMo] = App.FileDescrip tion
        aRS![IDMenu] = FormCtrl.Name
        aRS![NameMn] = xStri
        aRS.Update
        End If
        End If
        End With
        Next
        4 get all controls in Form and check if the tontrol is Menu or Not a menu
        If menu then checking the name of that control name string length is 13
        if yes then assigen vStri = FormCtrl.Captio n

        For mI = 1 To Len(vStri)
        If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
        Next

        5 replacing null if the string contain '&'
        this is not good, (beter use Replace(trim(vS tri),"&",""))

        vInti = pfGetNextID("SC MnuElements", "RecNbr", "")

        6 Geting Next Id of the Record

        aRS.AddNew
        aRS![RecNbr] = vInti
        aRS![IDModu] = UCase(Mid(App.T itle, 1, 2))
        aRS![NameMo] = App.FileDescrip tion
        aRS![IDMenu] = FormCtrl.Name
        aRS![NameMn] = xStri
        aRS.Update

        7 Adding New record,
        with new id,

        UCase(Mid(App.T itle, 1, 2))
        8 Converting Uppercase of Application first two Character

        App.FileDescrip tion
        9 geting Application File Description.

        FormCtrl.Name
        10 Form Name


        aRS.Update
        11 Updating Record

        this will give Error Because you are adding (aRS.AddNew) New Record but finaly you are Updating... Use (aRS.Save)


        Screen.MousePoi nter = 0
        MsgBox "Menu Elements Up-Load is Done !", vbInformation, App.FileDescrip tion


        12 set mousepointer to default arrow,
        Popup Information (!) msgbox

        OOOOOOOOOOOOOOo ooooooooooooooo ooK..........

        Comment

        Working...