This is probably a real dumb question but when this statement runs I get an error "Object doesn't support this property or method." I'm at a loss as to why I'm getting this error. I don't find any axcreds anywhere in this database. This is a database I'm trying to convert from an .mdb to a newer version of Access.
Any help is appreciated. If more information is needed let me know.
I don't know what questions to ask. so please don't get mad at me.
In doing more research I find that the OLE Class = TreeCtrl and the Class = MSComctlLib I have no idea where to find this. I'm sure my axcreds are located there, but where are they???
When I converted the .mdb to .accdb it didn't bring across the treectrl tables. I don't know where to locate these tables so don't know how to fix my problem.
20 2774 NeoPa 32,556
Expert Mod 16PB
Hi Tom.
I hear you're struggling to know how to express your situation clearly enough that others will be able to offer assistance. Unfortunately, you're the only feet we have on the ground so we are relying on you to do a decent job. Without knowing more about your problem it's very difficult for us to advise on how better to explain your problem. Call it a Catch-22 if you like.
It still leaves us in the dark & depending on you to give more clarity.
Tom - could you list the procedure that this code is in?
It also may be an issue with the parent form.
Or it could be as simple as a missing reference (you said you are converting an older DB - You may have missed including the references).
Hope this hepps!
I've been doing more searching and I think what this has to do is with the treectrl When the ctrl was created for student creds however when I converted the .mdb database the treectrl axcreds data didn't come across. I don't know where that data is or how to bring it across to the new .accdb.
The following code is where the error happens. I can send more if need.Thanks - Private Sub Form_Load()
-
Dim db As Database
-
Dim rst As Recordset
-
Dim Cred As String
-
-
subQB.Form.filter = ""
-
subQB.Form.FilterOn = False
-
-
Set db = CurrentDb
-
Set rst = db.OpenRecordset("SELECT DISTINCTROW Credentials.[Credential Code], Credentials.Description, Credentials.Status, Concerns.Concern, Concerns.ConcernID, Count(QuestionBank.Concern) AS CCount, CredCount.CountOfQuestionNum AS TCount, [CCount]/[TCount] AS CPer " & _
-
"FROM (Concerns RIGHT JOIN QuestionBank ON Concerns.ConcernID = QuestionBank.Concern) RIGHT JOIN ((Credentials RIGHT JOIN CredCount ON Credentials.[Credential Code] = CredCount.[Credential Code]) LEFT JOIN TestQuestions ON Credentials.[Credential Code] = TestQuestions.[Credential Code]) ON QuestionBank.QuestionID = TestQuestions.QBNum " & _
-
"WHERE (((Credentials.status) < 3)) GROUP BY Credentials.[Credential Code], Credentials.Description, Credentials.Status, Concerns.Concern, Concerns.ConcernID, CredCount.CountOfQuestionNum " & _
-
"ORDER BY Credentials.[Credential Code], Concerns.Concern;")
-
rst.MoveFirst
-
Do
-
Cred = rst.Fields("Credential Code")
-
If rst.Fields("Status") >= 1 And rst.Fields("Status") <= 2 Then
-
axCreds.Nodes.Add , , Cred, Cred & " - " & rst.Fields("Description") & " (" & getCredTot(Cred) & ")", "file"
-
Do
-
axCreds.Nodes.Add Cred, tvwChild, Cred & "-" & rst.Fields("ConcernID"), rst.Fields("Concern") & " (" & rst.Fields("CCount") & ")", "blank"
-
rst.MoveNext
-
If rst.EOF Then Exit Do
-
Loop Until Cred <> rst.Fields("Credential Code")
-
Else
-
axBooks.Nodes.Add , , Cred, Cred & " - " & rst.Fields("Description") & " (" & getCredTot(Cred) & ")", "file"
-
Do
-
axBooks.Nodes.Add Cred, tvwChild, Cred & "-" & rst.Fields("ConcernID"), rst.Fields("Concern") & " (" & rst.Fields("CCount") & ")", "blank"
-
rst.MoveNext
-
If rst.EOF Then Exit Do
-
Loop Until Cred <> rst.Fields("Credential Code")
-
End If
-
Loop Until rst.EOF
-
rst.Close
-
-
Set rst = db.OpenRecordset("SELECT T.[Credential Code],Status FROM TestQuestions AS T,Credentials AS C WHERE QBNum=" & subQB.Form.txtQuestionID & " AND T.[Credential Code]=C.[Credential Code] AND C.Status < 3 ORDER BY T.[Credential Code]")
-
If rst.EOF = False Then
-
rst.MoveFirst
-
Do
-
If rst.Fields("Status") >= 1 And rst.Fields("Status") <= 2 Then
-
axCreds.Nodes("" & rst.Fields("Credential Code") & "").Image = "used"
-
axCreds.Nodes("" & rst.Fields("Credential Code") & "-" & subQB.Form.cmbConcern & "").Image = "used"
-
Else
-
axBooks.Nodes("" & rst.Fields("Credential Code") & "").Image = "used"
-
axBooks.Nodes("" & rst.Fields("Credential Code") & "-" & subQB.Form.cmbConcern & "").Image = "used"
-
End If
-
rst.MoveNext
-
Loop Until rst.EOF
-
End If
-
rst.Close
-
Set db = Nothing
-
End Sub
Tom,
I don't see where you've declared axCreds to be anything. You need:
before you can do anything with the nodes.
I hope this hepps!
Remember I'm converting this from a .mdb to .accdb I didn't write this program so I would hope that the code would be there. Even if I declare the axcreds where will I find the data that is supposed to be in this table or node.
Well, one step at a time. We need the system to know what axCreds is first. I also see a User-Defined Function: getCredTot() . You'll need to resolve the obvious issues before you can get into any details.
One method of troubleshooting I sometimes use (when importing huge chunks of code is to comment out the entire block and then uncomment one line at a time and compile. If there is an If...Then statement (or other nested set of lines) I uncomment the first and last lines, then go through each line inside.
This make take you some time to figure out what exactly is missing, as there may be multiple issues--you're just getting one error on one thing.
I've added the Dim axCreds as treeview, I also made sure I have the activex control Microsoft treeview control. It still stops on the statement Me.parent.axCreds.nodes.count Not sure where to go from here.
When I press Ok on that statement the form comes up but I don't have the data in the axCreds sub form.
Tom,
Please try to help us out here. The statement "Me.parent.axCreds.nodes.count" is not in the code you provided.
Sorry, here's the code - Private Sub Form_Current()
-
Dim db As Database
-
Dim rst As Recordset
-
Dim i As Integer
-
Dim tNode As Object
-
Dim axCreds As TreeView
-
If ignore = False Then
-
If IsNull(txtQuestionID) And delInProg = False Then
-
setEdit True
-
Else
-
setEdit False
-
End If
-
If Me.Parent.Name = "ExamCreate" And IsNull(txtQuestionID) = False Then
-
Set db = CurrentDb
-
Set rst = db.OpenRecordset("SELECT * FROM TestQuestions WHERE [Credential Code]='" & Me.Parent.lstCred & "' AND QBNum=" & txtQuestionID)
-
If rst.EOF Then
-
Me.Parent.chkInc.Value = False
-
Me.Parent.chkSeed.Enabled = False
-
Me.Parent.chkSeed.Value = False
-
Else
-
Me.Parent.chkInc.Value = True
-
Me.Parent.chkSeed.Enabled = True
-
Me.Parent.chkSeed.Value = rst.Fields("SeedQuestion")
-
End If
-
rst.Close
-
Set db = Nothing
-
ElseIf Me.Parent.Name = "QBPlus" Then
-
'Me.Parent.Form.axCreds.Nodes
-
If Me.Parent.axCreds.Nodes.count > 0 And Form.RecordsetClone.RecordCount > 0 Then
-
For i = 1 To Me.Parent.axCreds.Nodes.count
-
If InStr(Me.Parent.axCreds.Nodes(i).key, "-") Then
-
Me.Parent.axCreds.Nodes(i).Image = "blank"
-
Else
-
Me.Parent.axCreds.Nodes(i).Image = "file"
-
End If
-
Next
-
For i = 1 To Me.Parent.axBooks.Nodes.count
-
If InStr(Me.Parent.axBooks.Nodes(i).key, "-") Then
-
Me.Parent.axBooks.Nodes(i).Image = "blank"
-
Else
-
Me.Parent.axBooks.Nodes(i).Image = "file"
-
End If
-
Next
-
-
If IsNull(txtQuestionID) Then Exit Sub
-
-
Set db = CurrentDb
-
Set rst = db.OpenRecordset("SELECT T.[Credential Code],Status FROM TestQuestions AS T,Credentials AS C WHERE QBNum=" & txtQuestionID & " AND T.[Credential Code]=C.[Credential Code] AND C.Status < 3 ORDER BY T.[Credential Code]")
-
If rst.EOF = False Then
-
rst.MoveFirst
-
Do
-
If rst.Fields("Status") <> 0 Then
-
Me.Parent.axCreds.Nodes("" & rst.Fields("Credential Code") & "").Image = "used"
-
Me.Parent.axCreds.Nodes("" & rst.Fields("Credential Code") & "-" & cmbConcern & "").Image = "used"
-
Else
-
Me.Parent.axBooks.Nodes("" & rst.Fields("Credential Code") & "").Image = "used"
-
Me.Parent.axBooks.Nodes("" & rst.Fields("Credential Code") & "-" & cmbConcern & "").Image = "used"
-
End If
-
rst.MoveNext
-
Loop Until rst.EOF
-
End If
-
rst.Close
-
Set db = Nothing
-
-
Set tNode = Me.Parent.axCreds.Object.SelectedItem
-
If Not tNode Is Nothing Then
-
If tNode.Image = "used" Then
-
Me.Parent.cmdAdd.Enabled = False
-
Me.Parent.cmdDel.Enabled = True
-
Else
-
Me.Parent.cmdAdd.Enabled = True
-
Me.Parent.cmdDel.Enabled = False
-
End If
-
Else
-
Set tNode = Me.Parent.axBooks.Object.SelectedItem
-
If Not tNode Is Nothing Then
-
If tNode.Image = "used" Then
-
Me.Parent.cmdAdd.Enabled = False
-
Me.Parent.cmdDel.Enabled = True
-
Else
-
Me.Parent.cmdAdd.Enabled = True
-
Me.Parent.cmdDel.Enabled = False
-
End If
-
End If
-
End If
-
Set tNode = Nothing
-
End If
-
End If
-
End If
-
-
End Sub
You also need to set the variable of axCreds to the TreeView control that you are using. I am having no issues accessing the count properties of the TreeView Nodes.
There seems to be much more missing from the VBA you've posted than what we can work with. The "Parent" indicates that your Form is a Subform on another form. The code you posted previously also indicates that there may be a subform on the form you are looking at.
Again, you are going to have to tackle this one small step at a time. It appears much of what is being referenced is not present.
In the code I just posted the parent form is QBPlus line 27. I've also removed the ' from line 28 and the program stops on the line also.
I still think we are chasing our tails by staying in this form. The issue is stemming from the parent. There may be issues there that need to be fixed before you can address them here on this form. Is this approach to troubleshooting making any sense, yet?
The error has always pointed to the parent form (note my second statement in Post #3). This is where you need to start.
Tom,
I still think you are approaching this from "the whole thing."
You need to begin with each small step:
Recreate the main form
Add the minimal amount of Code to open and close that form without a hitch.
Gradually add controls to your form
Add code for the controls
Add the TreeView control
Gradually add parts of the code to add functionality to the TreeView control
etc.
I still think this is a referencing problem. Either the control is not declared, set or referenced properly.
Again, in two minutes, I created a form with a TreeView control, dimmed a TreeView, set that object to the control, and was able to access all properties. Everything is there. I think you're just biting off more than you can chew at one time.
One step at a time--not many of us here have the time to work through "the whole thing." We are trying to point you toward where to focus your troubleshooting.
The nature of the error has to do with proper referencing. The code does not understand that the object is a TreeView control. It's that simple. That's the answer. You need to find out why it is not declared that way. I think there may be a module somewhere that is declaring it and setting it so publicly, but the code provided doesn't mention it anywhere. Once that public bit is uncovered, you will find success.
One more questions and then I'll continue with the step by stem. Where is the data kept for a tree ctrl or node. That's the part I don't understand. Is this tree ctrl or tree view like a table with columns and rows? and if so can I edit this like a table.
Usually a TreeView is filled "from somewhere." Usually from a Table. The user interacts with the tree view to manipulate the data in the table.
NB: I have not used TreeView controls, but an object-based language like VBA will treat it like any other object.
NeoPa 32,556
Expert Mod 16PB
First I must congratulate Twinny for showing such patience. Above & beyond in my view.
As for a TreeView control, like Twinny I've heard of them, and seen themn in action, but I've never got my hands dirty with them at all. Nevertheless, in all the objects I've dealt with in Access that manage data there's a consistency to how the data is specified.
Forms & Repords have a RecordSource property and Controls have a ControlSource property. Have you looked to see if the TreeView Control has such a property? If so what is it set to, if anything?
TreeViews do not have a record source.
NeoPa 32,556
Expert Mod 16PB
So it doesn't. Well, that's weird. I'd ask how it gets populated but that might allow the thread to be side-tracked so I won't here.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: sincethe2004 |
last post by:
I have a C# source code need to share between different programs, does C#
have statement like include in C?
|
by: David |
last post by:
This is my xml sample:
<po>
<PurchaseOrderDetail>
<ProductLineItem>
<LineNumber>1</LineNumber>
<ProductIdentification>
<aaa>...</aaa>
<bbb />
</ProductIdentification>
|
by: Jim in Arizona |
last post by:
This doesn't make any sense to me. I'm hoping some SQL guru out there knows
the answer.
I'm making a help desk type database system. There's only two tables, one
called TTickets and the other...
|
by: Christian Rühl |
last post by:
hey! what i wanna do sounds very simple at first, but it turned out to
be a real bone crusher...
i want to check if a treeView node is checked and if a correspondent
node in my xml config file...
|
by: Michel Esber |
last post by:
Hello,
DB2 LUW V8 FixPack 13.
create table Table (ID varchar(20), USED char)
I need to find out the total row count per ID, as well as the row count
where USED=Y.
I could do this with a...
|
by: npm |
last post by:
Hi,
I'm trying to add an IF statement to this javascript that will select/display only those xml nodes either with a certain attribute or attribute value.
Here's my xml code:
<stations>...
|
by: HIFIZombie |
last post by:
or be able to tell if the selected treenode is a parent node. I have
looked at .gettype but how do i check it against something like
treeview1.gettype = treeview.nodes.parentnode
I use my...
|
by: abueno |
last post by:
//It should count how many characters are letters in the English alphabet, and is
displaying the correct letters, but is not counting good.
void FunctionCountLetters(char s)
{
int len;
int i;...
|
by: dotnetuser |
last post by:
I have the following HTML , see at the end of this question.
Please suggest an XPath expression to return all the top level Parent rows only, i.e. all the tr elements , there should not be any tr...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |