Hi guys,
Ive beeing trying to figure out a drag drop code in my treeview and i keep getting this error 'the expression mousedown you entered as the event property setting produced the follwoing error: Procedure declaration does not match description of event or procedure having the same name.'
i dont understanding this at all... my coding is obviously wrong and if someone could steer me in the right direction i would really appreciate it
Here's my code :
Option Compare Database
Option Explicit
Private Sub Custodian_history_form_enter()
[Custodian History Form].Nodes.Remove (1)
With Me.[Custodian History Form]
.Style = 6
.LineStyle = tvwRootLines
.Indentation = 240
.Appearance = ccFlat
.HideSelection = False
.BorderStyle = ccFixedSingle
.HotTracking = True
.FullRowSelect = True
.Checkboxes = False
.SingleSel = False
.Sorted = False
.Scroll = True
.LabelEdit = tvwManual
.Font.Name = "Verdana"
.Font.Size = 9
End With
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strQuery1 As String
Dim nod As Object
Dim nodChild As Object
Dim strNode1Text As String
Dim strVisibleText As String
Dim strMessage As String
Dim intVBMsg As Integer
Dim intCounter As Integer
Dim stringcount As String
Dim strQuery2 As String
Dim rs2 As DAO.Recordset
Dim strNode2Text As String
Dim db2 As DAO.Database
Dim rs3 As DAO.Recordset
Me.[Custodian History Form].Nodes.Add Text:="Asset Records", Key:="Custodianhistory23"
strQuery2 = "select DISTINCT [Name] from [Asset master Query2]"
Set db = CurrentDb
Set rs2 = db.OpenRecordset(strQuery2)
With Me.[Custodian History Form]
Do Until rs2.EOF
strNode2Text = StrConv("Level1" & rs2![Name], vbLowerCase)
strVisibleText = rs2![Name]
'if model name is null, will have problem
If IsNull(rs2![Name]) Then
MsgBox "number is null"
strVisibleText = "no name"
End If
stringcount = CStr(intCounter)
strNode2Text = strNode2Text + stringcount
Set nod = Me.[Custodian History Form].Nodes.Add(Relative:="Custodianhistory23", relationship:=tvwChild, Key:=strNode2Text, Text:=strVisibleText)
'Now add the child root for this Asset Name
Set rs = db.OpenRecordset("SELECT DISTINCT [asset name] FROM [Asset master Query2] WHERE [name]='" & strVisibleText & "'")
Do Until rs.EOF
Set nodChild = .Nodes.Add(Relative:=strNode2Text, relationship:=tvwChild, Text:=rs("Asset Name"))
nodChild.Expanded = False
rs.MoveNext
Loop
rs2.MoveNext
Loop
End With
Set rs2 = Nothing
Set db = Nothing
End Sub
'''''''''''''''''''''''''''''''
' Start Of Drag Drop Code '
'''''''''''''''''''''''''''''''
Private Sub Custodian_History_Form__mousedown(Custodian_Histor y_Form As Form)
Set mfrmDragFrm = [Custodian History Form]
Set mctldragctrl = MouseDown.ActiveControl
mintcurrentmode = DRAG_MODE
End Sub
Sub Custodian_history_form_startdrag(Custodian_History _Form As Form)
Set mfrmDragFrm = [Custodian History Form]
Set mctldragctrl = MouseDown.ActiveControl
mbytCurrentMode = DRAG_MODE
If TypeOf mctldragctrl Is ListBox Then
If mctldragctrl.itemselected.Count > 1 Then
mbytDragQuantity = multi_value
Else
mbytDragQuantity = single_value
End If
Else
mbytDragQuantity = single_value
End If
SetDragCursor
End Sub
Private Sub custodian_history_form_mouseup()
mbytCurrentMode = DROP_MODE
mbytDragQuantity = NO_MODE
msngDropTime = Timer()
SetDragCursor
End Sub
Ive beeing trying to figure out a drag drop code in my treeview and i keep getting this error 'the expression mousedown you entered as the event property setting produced the follwoing error: Procedure declaration does not match description of event or procedure having the same name.'
i dont understanding this at all... my coding is obviously wrong and if someone could steer me in the right direction i would really appreciate it
Here's my code :
Option Compare Database
Option Explicit
Private Sub Custodian_history_form_enter()
[Custodian History Form].Nodes.Remove (1)
With Me.[Custodian History Form]
.Style = 6
.LineStyle = tvwRootLines
.Indentation = 240
.Appearance = ccFlat
.HideSelection = False
.BorderStyle = ccFixedSingle
.HotTracking = True
.FullRowSelect = True
.Checkboxes = False
.SingleSel = False
.Sorted = False
.Scroll = True
.LabelEdit = tvwManual
.Font.Name = "Verdana"
.Font.Size = 9
End With
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strQuery1 As String
Dim nod As Object
Dim nodChild As Object
Dim strNode1Text As String
Dim strVisibleText As String
Dim strMessage As String
Dim intVBMsg As Integer
Dim intCounter As Integer
Dim stringcount As String
Dim strQuery2 As String
Dim rs2 As DAO.Recordset
Dim strNode2Text As String
Dim db2 As DAO.Database
Dim rs3 As DAO.Recordset
Me.[Custodian History Form].Nodes.Add Text:="Asset Records", Key:="Custodianhistory23"
strQuery2 = "select DISTINCT [Name] from [Asset master Query2]"
Set db = CurrentDb
Set rs2 = db.OpenRecordset(strQuery2)
With Me.[Custodian History Form]
Do Until rs2.EOF
strNode2Text = StrConv("Level1" & rs2![Name], vbLowerCase)
strVisibleText = rs2![Name]
'if model name is null, will have problem
If IsNull(rs2![Name]) Then
MsgBox "number is null"
strVisibleText = "no name"
End If
stringcount = CStr(intCounter)
strNode2Text = strNode2Text + stringcount
Set nod = Me.[Custodian History Form].Nodes.Add(Relative:="Custodianhistory23", relationship:=tvwChild, Key:=strNode2Text, Text:=strVisibleText)
'Now add the child root for this Asset Name
Set rs = db.OpenRecordset("SELECT DISTINCT [asset name] FROM [Asset master Query2] WHERE [name]='" & strVisibleText & "'")
Do Until rs.EOF
Set nodChild = .Nodes.Add(Relative:=strNode2Text, relationship:=tvwChild, Text:=rs("Asset Name"))
nodChild.Expanded = False
rs.MoveNext
Loop
rs2.MoveNext
Loop
End With
Set rs2 = Nothing
Set db = Nothing
End Sub
'''''''''''''''''''''''''''''''
' Start Of Drag Drop Code '
'''''''''''''''''''''''''''''''
Private Sub Custodian_History_Form__mousedown(Custodian_Histor y_Form As Form)
Set mfrmDragFrm = [Custodian History Form]
Set mctldragctrl = MouseDown.ActiveControl
mintcurrentmode = DRAG_MODE
End Sub
Sub Custodian_history_form_startdrag(Custodian_History _Form As Form)
Set mfrmDragFrm = [Custodian History Form]
Set mctldragctrl = MouseDown.ActiveControl
mbytCurrentMode = DRAG_MODE
If TypeOf mctldragctrl Is ListBox Then
If mctldragctrl.itemselected.Count > 1 Then
mbytDragQuantity = multi_value
Else
mbytDragQuantity = single_value
End If
Else
mbytDragQuantity = single_value
End If
SetDragCursor
End Sub
Private Sub custodian_history_form_mouseup()
mbytCurrentMode = DROP_MODE
mbytDragQuantity = NO_MODE
msngDropTime = Timer()
SetDragCursor
End Sub