I'm using a Mytreeview activex example for a project I'm making at the moment.
In short, I want to have a login screen that takes the value (a clocking number) from that and filters what the people can see in the tree view structure.
I set up a query to test whether this would work. I put in a user ID in the query as the criteria and bingo.. I was able to establish different trees for different people. Great I thought! So off I set writing something that automates it.
My idea was to take the value from the login screen (clocking number in the format example "b6666") and use that criteria to filter people records. This query ran from the onload function addnodes. My code in the query is as simple as it gets. I just use:
[Forms!]![Mainform]![Textboxvalue] to extract the information
This will not work for me at all. The query extracts exactly the information I'm after if I run it separately, though when running the form I get a "Run-time error 3061 too few parameters expected 1" message box come up.
Now I'm pretty sure it's the code that populates the tree on the load command of the form. I feel it's the "Set Rst = DB.OpenRecordset" line.. would it be a recordset if it's in a query? Could be totally wrong. Does anyone have any ideas to why it works standalone but not generated from this code:
thanks in advance!!
' Adds the data to the tree
Dim DB As DAO.Database
Dim Rst As DAO.Recordset
Dim StrParent As String
Dim StrChild As String
' create a recordset of tbk_obs_l
Set DB = CurrentDb
Set Rst = DB.OpenRecordset("Select qry_tree_access_main_form.* from qry_tree_access_main_form;")
StrParent = ""
StrChild = ""
Do Until Rst.EOF = True
'Build the Nodes for the TreeView Control
' level 1 is the parent
' loops through the recordset adding data to the tree
that works great! thanks very much for your help!! much appricated, was driving me crazy hehe
So was it that (other than the textbox being blank) that it needs to function off a table rather than a query? I noticed your EOF code in there - was that was couldn't function out of the query. Sorry for the questions just interested
I believe access only converts forward and not backwards. As a company we had been using access 97 for years and sometimes it's important to revert back to the 97 version. I've found a credible (but ambiguous) solution is to create 97 db and then copy and paste the tables and so on into it
Hope that's of help, again thanks so much for your help, saved me HOURS