Connecting Tech Pros Worldwide Forums | Help | Site Map

help me ( codes)

Member
 
Join Date: Feb 2007
Location: Qatar
Posts: 43
#1: Feb 10 '07
please explain the following code to me
I want to know in detail would you help me?



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

hariharanmca's Avatar
Lives Here
 
Join Date: Dec 2006
Location: Banglore/India
Posts: 1,987
#2: Feb 10 '07

re: help me ( codes)


Quote:

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.MousePointer = 11
mI = ExecuteSQL("DELETE FROM SCMnuElements WHERE IDModu='" & Mid(App.Title, 1, 2) & "'")
Set aRS = GetRSLoaded("SCMnuElements")
Dim xStri As String
Dim FormCtrl As Control
For Each FormCtrl In FrmXX
With FormCtrl
If TypeOf FormCtrl Is Menu Then
If Len(FormCtrl.Name) = 13 Then
vStri = FormCtrl.Caption
xStri = ""
For mI = 1 To Len(vStri)
If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
Next
vInti = pfGetNextID("SCMnuElements", "RecNbr", "")
aRS.AddNew
aRS![RecNbr] = vInti
aRS![IDModu] = UCase(Mid(App.Title, 1, 2))
aRS![NameMo] = App.FileDescription
aRS![IDMenu] = FormCtrl.Name
aRS![NameMn] = xStri
aRS.Update
End If
End If
End With
Next
Screen.MousePointer = 0
MsgBox "Menu Elements Up-Load is Done !", vbInformation, App.FileDescription
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
Member
 
Join Date: Feb 2007
Location: Qatar
Posts: 43
#3: Feb 10 '07

re: help me ( codes)


Quote:

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.
hariharanmca's Avatar
Lives Here
 
Join Date: Dec 2006
Location: Banglore/India
Posts: 1,987
#4: Feb 10 '07

re: help me ( codes)


Quote:

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.MousePointer = 11
mI = ExecuteSQL("DELETE FROM SCMnuElements WHERE IDModu='" & Mid(App.Title, 1, 2) & "'")
Set aRS = GetRSLoaded("SCMnuElements")
Dim xStri As String
Dim FormCtrl As Control
For Each FormCtrl In FrmXX
With FormCtrl
If TypeOf FormCtrl Is Menu Then
If Len(FormCtrl.Name) = 13 Then
vStri = FormCtrl.Caption
xStri = ""
For mI = 1 To Len(vStri)
If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
Next
vInti = pfGetNextID("SCMnuElements", "RecNbr", "")
aRS.AddNew
aRS![RecNbr] = vInti
aRS![IDModu] = UCase(Mid(App.Title, 1, 2))
aRS![NameMo] = App.FileDescription
aRS![IDMenu] = FormCtrl.Name
aRS![NameMn] = xStri
aRS.Update
End If
End If
End With
Next
Screen.MousePointer = 0
MsgBox "Menu Elements Up-Load is Done !", vbInformation, App.FileDescription
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.Name) = 13 Then
vStri = FormCtrl.Caption
xStri = ""
For mI = 1 To Len(vStri)
If Not Mid(vStri, mI, 1) = "&" Then xStri = xStri & Mid(vStri, mI, 1)
Next
vInti = pfGetNextID("SCMnuElements", "RecNbr", "")
aRS.AddNew
aRS![RecNbr] = vInti
aRS![IDModu] = UCase(Mid(App.Title, 1, 2))
aRS![NameMo] = App.FileDescription
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.Caption

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(vStri),"&",""))

vInti = pfGetNextID("SCMnuElements", "RecNbr", "")

6 Geting Next Id of the Record

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

7 Adding New record,
with new id,

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

App.FileDescription
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.MousePointer = 0
MsgBox "Menu Elements Up-Load is Done !", vbInformation, App.FileDescription


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

OOOOOOOOOOOOOOooooooooooooooooooK..........
Reply