Modules & VBA :: Expanding Treeview Automatically When Node Matches A String Variable From A Table

Jul 14, 2014

I'd like to expand me tree view automatically when a node matches a string variable from a table. In other words, when a node in a tree matches the given name (variable), the tree will expand all the way down to that name. I guess I need to use "For each node" and when the node and variable match, the tree structure will show up.

I have come up with something like this:

Code:
For Each nd In Me.tree.Nodes
If nd = level1 Then
nd.Child.EnsureVisible
Exit For
End If
Next nd
Me.tree.SetFocus

But this only shows the first level of my tree ( btw. I have a 3 level tree). I get lost inside the FOR when I want to make use of another two variables - level2 and level 3

View Replies


ADVERTISEMENT

Modules & VBA :: How To Open Treeview Node To A Specific Folder / Subfolder

Dec 18, 2014

I have a tree-view object that is filled with a specific folder list, when a command button is pressed I would like too expand to a specific node based on a variable/foldername.

How to achieve this? My knowledge of tree-view is limited and I am still learning VBA.

View 2 Replies View Related

Treeview SubChild Node.

Jun 24, 2005

Hi there,

I'm venturing into the abyss of treeviews and have read many threads on this subject. I have two questions to ask regarding the attached sample db, if anyone can help me please.

1) How can I adapt the existing code and create subnodes (or sub child nodes). For example, how can I create a sub-node of OPEN FORM2?
2) What is the syntax for an ONCLICK event, i.e. by clicking on OPEN FORM2 I want it to open FORM2?

Thanks in advance,
Paul.

View 5 Replies View Related

General :: Link Parent / Child Node To A Control On Main Form In Treeview

Oct 7, 2012

I downloaded a sample treeview application I have modified most of its to suit my need, except one thing. I want link parent/child node the main form to the main form through a subform on the CategoryID.

The following is the original code where when a child not is clicked only pops up a "linked" msgbox. I need to modify the part of the code on the Select Case "C" in red:

Code:
'----------------------------
Sub DisplayForm(i As Integer)
'----------------------------
' for this Treeview I do not want a double-click on a parent node
' to open the applicable Category form, but pressing the shift key
' should open the marriage form applicable to the parent node. Shift
' or double-click on a child node should open the applicable
' offence form.

Dim strKey As String
Dim strTag As String
Dim strFilter As String

[Code] ....

View 1 Replies View Related

Modules & VBA :: Debug Error For TreeView Variable Definition?

Jun 24, 2015

I am using Windows 8.1 64 bit system. Into attached access file (OfferStudy.accdb) ,trying to load an activeX TreeView control by defining into a form module. First, I created an empty form and activeX Treeview control.When I define tv variable As TreeView as created in application, it is changing as Dim tv As treeView instead of TreeView. After my code is completed,an error message ("user-defined type not defined") is returning as shown in attached (DebugError.png)file.

I suppose that there is some conflict on creating activeX control on my Access 2013 application.

View 4 Replies View Related

Modules & VBA :: Treeview Feature - Determine Exact String Width (in Pixels)

Dec 12, 2014

I am working with the Access Treeview feature and I'd like to align the different elements in my nodes exactly below each other.

Therefore I need exact distances (if string is longer then XY, cut short, if shorter, extend to XY).

Of course I cannot work with len() and fill with spaces because letters have different widths.

Is there a way to determine the exact width of a string? e.g. in pixels?

View 7 Replies View Related

Modules & VBA :: How To Construct String For Variable

Sep 10, 2013

I am trying to set the following variable that will be used to create a PDF file in an already existing folder and name the file WorkorderIDddmmyyyy-hhnnss.pdf

The following variable setting creates the filenameddmmyyyy-hhnnssWorkorderID.pdf.

mFilename = "C:RPR AccessPDF Reports Emailed" & Format(Now(), "ddmmyyyy-hhnnss") & WorkorderID & ".pdf"

DoCmd.OutputTo acOutputReport, mReportName, acFormatPDF, mFilename, True

I just can't figure out how to construct it correctly.

Also, is there a way to dynamically create a folder if the folder doesn't already exist? I currently hard code the folder name but would really like to create the folder name based upon some other variable.

View 8 Replies View Related

Modules & VBA :: How To Get Portion Of String Into Variable

Jun 19, 2015

How to I get a portion of a string into a variable?

I want to capture the table name of a recordsource.

The problem is sometimes the recordsource is "Select * from mytable where ID = 6" or "Select * from mytable" or "mytable"

I want to put "mytable" in a variable for later use.

View 11 Replies View Related

Modules & VBA :: SQL String - Update Query Using A Variable Value

Jul 22, 2013

I am currently trying to create an update query (building a SQL String in VBA for a command button click event) to update a variable's value into a table.

Basically, there are 2 tables, displayed in 2 sub froms within the same main form. (OldTable and NewTable for arguments sake)

The basic method I want to implement is that a user highlights a record in the subform of "NewTable". (This value is stored as a variable "NewJPNUM" This value is then to be inserted into the highlighted row (or rows) of table OldTable on command button click.

So the basic idea is a user highlights a row in one table and this value is stored as a variable "NewJPNUM" . The user then highlights a row or rows in "OldTable" and the value from variable "NewJPNUM" is then written to field "NewJPNUM" in "NewTable" on command button click.

I am not experienced with Access but have decent experience in Excel / VBA so not really sure of best practice methods etc.

View 3 Replies View Related

Modules & VBA :: Function - Can A String Be Optional Variable?

Aug 26, 2014

I am amending some Code I found online for an audit table, I need to store additional information in the table that is associated with some forms but not others.

I have researched about putting optional variables in, but I read this only works with the type VARIANT.

Is there a way to make a string optional as my fields contain text?

here is my code so far:

Sub AuditChanges(IDField As String, UserAction As String, Optional UserID As String, Optional DeviceID As String, Optional SimID As String)
On Error GoTo AuditChanges_Err
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim ctl As Control
Dim datTimeCheck As Date

[Code]...

View 5 Replies View Related

Modules & VBA :: Inserting String Variable In SQL Statement

Dec 7, 2014

I am trying to write vba code to enter a form. A am using an SQL statement in vba to enter the form with it.

I want to include a string variable in the WHERE clause of the SQL statement. The string variable is introduced in the DIM statement before coming up to the SQL statement.

The following is the SQL statement. numrukarta is the string variable I want to introduce. I need to know the exact punctuation to be able to insert it into this statement.

StrSq1 = " SELECT Employees.NName, Employees.SSurname, WorkItems.IDcardNo, WorkItems.DDate, WorkItems.EntryTime, WorkItems.FinishTime, WorkItems.Roster" _
& " FROM Employees INNER JOIN WorkItems ON Employees.IDcardNo = WorkItems.IDcardNo" _
& " WHERE (((WorkItems.IDcardNo)= numrukarta) AND ((WorkItems.DDate)=Date()) AND ((WorkItems.FinishTime) Is Null);" AND (Not (WorkItems.Roster) Is Null))

View 3 Replies View Related

Modules & VBA :: Using Public Function To Feed A Variable String To Query

Feb 26, 2014

I am using a public function to feed a variable string to a query. So far I have got:

Code:
Public Function ClientStreetModule(firstLVar As Variant, streetVar As Variant, newFL As Variant) As String
Dim cslStr1 As String, newStreet As String
newStreet = Right(streetVar, Len(streetVar) - Len(newFL))

[code]....

However, I only need to use newStreet as the true part of iif, in which instance all are longer. At least I think this is the problem. I realise I might need to use NZ but am not sure how. Why it is evaluating and giving errors for all records and not just when the iif criteria is true as I want it to?

View 7 Replies View Related

Wildcard Searching / Partial String Matches

Apr 8, 2008

Hi there,

I've successfully created, for the first time, a database with many attributes that is searchable by most of those attributes as well. I've finally gotten the swing of how tables, forms, queries, and macros link up and am understanding how MSA works.

I can't seem to find any information on here that tells me how to do wildcard searches. For my particular application, people enter items into the database in a nonstandard fashion, i.e. "oring," "o-ring," and "o ring." I need to enable the capability to search "ring" so my search functions are fully maximized.

Can anyone help?


Thanks!

View 2 Replies View Related

Modules & VBA :: Automatic Expanding List

Sep 2, 2013

I'm making an accounts package, the user creates job reports every time they complete a job. The user then creates an invoice which contains the information from a job report.Any one invoice can contain information from multiple job reports.There is a field called J_InvoiceNumber in the job reports table and field called I_InvoiceNumber in the Invoices table. A particular job report is linked to a invoice by using the same number in J_InvoiceNumber as was in I_InvoiceNumber. let me give you an example:

JobReport1, JobReport2 and Jobreport3 all have "1" in their J_InvoiceNumber Field
Jobreport4 has "2" in it's J_InvoiceNumber field.

so now Invoice1 which has "1" in it's I_InvoiceNumber field has 3 job reports and Invoice2 which has "2" in it's I_InvoiceNumber field has 1 job report.This works for presenting the information for each invoice in a Access Report but now I'm trying to make a table view just to see all the invoices and job reports in a big list.

The problem is that using a query presents me with the same information duplicated. So in the example the query would display I_InvoiceNumber as "1" for jobreport1 then a new record showing I_InvoiceNumber as "1" for jobreport2 and then another new record for jobreport3 again showing I_InvoiceNumber as "1".

What I want is for I_InvoiceNumber to be displayed once and then prehaps a expanding tree showing all the job reports sharing this number in their J_InvoiceNumber field.

View 2 Replies View Related

Modules & VBA :: Create Multiple Expanding / Collapsing Sections

Mar 25, 2015

I found a post where it shows how to create a single collapsable/expandable section. I am needing to do this for 10 sections with a lot of information in between each section. The coding that this post provides does not seem doable for that many sections. How to create a collapsable/expandable subform?

View 1 Replies View Related

Modules & VBA :: Scheduling System That Automates Some Redundant Tasks - Expanding Subforms?

Jul 28, 2014

I'm working on a scheduling system for my fathers company that automates some redundant tasks. Most importantly the system manages the order of processes on different parts (ie, part "tubes" may be cut, then drilled, then welded, then shipped).

I'm trying to create a form that allows for the editing and viewing of all the parts and the processes for each part for a specific work Order. Ideally the information that applies to all the parts (Work order Number, due date etc) would appear at the top of the form with all of the processes to appear beneath (Separated into groups - all the parts to be welded shown together). My problem with using sub forms for this was that I need all the records to be shown without scrolling. Is there a way to dynamically change the size of each Subform to match the required size, or is there a better feature to use?

View 7 Replies View Related

Modules & VBA :: Check If Data In Table 1 Matches With Any Of Data In Table 2

Dec 4, 2014

There are two tabs named Table1 and Table2. In actual there are two tables in Access database named Table1 and Table2. How the data is stored in ACcess tables, I have made two tabs in excel workbook. Now I want Access VBA code that will check if data in Reference field of Table1 matches with any of the data in Reference field of Table2.

If it matches then change the status of the corresponding record of Table2 with either "Withdrawn","Obsolete" or "Updated". SO it depends upon which field out of "WIthdrawn","Obsolete" and "Updated" in Table1 stores "Y". At a time only one of them will have "Y" and rest of two fields will have "N" as shown in the sheets.

As in the example, now Reference "R566" of Table1 matches with Table2 Reference so the status field in Table2 for that record will be "WithDrawn".

View 14 Replies View Related

Using A Defined Variable In An SQL String

Jan 9, 2008

Hello

Can anyone tell me how I use a variable I have defined within a SQL string.

e.g.

***code start ***

Dim ComputerName as string
Dim Sqlstr as string

ComputerName = Environ("ComputerName")
Sqlstr = "INSERT INTO ComputerName ("ComputerName") SELECT ***This is where I need help including the variable ComputerName I defined above ****

I would really appreciate some help.

Thank you :-)

View 6 Replies View Related

Concatenate String And Variable

Apr 3, 2006

Hey all, hope this question isn't too newbiefied :D .

I have a database where I must run 10 tests depending on which product I have selected (from a drop box). Each product requires different tests (of the 10) and I am hiding the tests that I do not need after the product is selected. The way I have it set up right now is I have 10 different If statements...one for each test on the "On Change" event.

I have been trying to reduce this down to one If statement nested inside a while loop, but my visual basic isn't very good. I have named the Test buttons Test3- Test13, and want to increment just the number of the test. However, when I try to plug in my concatenated string, I have problems. My code is as follows:

Dim testcount As Integer
Dim testcheck as Boolean
Dim testnumber as String

testcount = 3

While (testcount < 14)

testnumber = "Test" & testcount
If Me.selectedproduct.Column(testcount) = True
Me.testnumber.Visible = True
Else:
Me.testnumber.visible = False
End If

testcount = testcount + 1
WEnd



Me.testnumber is obviously not an object on the Form...so I guess my real question is, how do I get visual basic to plugin the variable testnumber so that the code reads Me.Test3.Visible.

Any help would be appreciated.

View 2 Replies View Related

How To Automatically Set A Variable To The System Date

Mar 18, 2006

i have a date variable that i wish to be automatically set to the system date for each new record. is this possible and if so how. Many thanks.

View 6 Replies View Related

Modules & VBA :: SQL Statement DELETE With Variable As Table

Aug 14, 2014

I'm trying to run this very very simple code but I get a Run-time error '3450' Syntax error in query. Incomplete query clause. For sure the problem is the variable I used as Table parameter but I cannot understand where my error is :

Private Sub cmdRunCheck_Click()
Dim strSQL As String
Dim strTempTbl As String
strTempTbl = "tblCheckDoubles"
strSQL = "DELETE * FROM " & "'" & strTempTbl & "'"
CurrentDb.Execute strSQL, dbFailOnError
End Sub

What is clear is that if I use this line the Sub is working smoothly

strSQL = "DELETE * FROM tblCheckDoubles"

Please do not tell me that it is not possible to use a variable as Table parameter....

View 8 Replies View Related

Modules & VBA :: How To Use Treeview Click Event To Show Pictures In Folders

Dec 10, 2014

I have been looking into populating a tree-view with folders and files, and have found some great examples for doing this, How ever...I cannot seem to work out how to show files/pictures in a form based on the click event of the tree-view.

I have managed to do an onclick event for the files in the tree-view, but I cannot seem to get the onclick event for folders in a tree-view.

Here is an example which I am working on at the moment, but get the error Object variable Or with block variable not set.

Code:
Private Sub tvw_Click()
Dim tClient As String
Dim tParent As Scripting.folder
Dim fd As Scripting.folder
Dim fNode As MSComctlLib.Node

[Code] .....

View 14 Replies View Related

Combo Box Value To Automatically Put Value From Different Variable Into Text Field

Mar 19, 2005

I have requested this before but the example given did not fit my situation and I had a heck of a time trying to adapt the example given to me so I will step by step describe what I need. thanks...


Can someone show me how to do the following:

1) Take a combo box that looks up a table that has 2 variables (Var1 and Var2).

2) Depending on the value chosen in the combobox (Var1) then a text field will automatically have the value (Var2) appear.

3) This information from combo box and text field will then be stored in a separate table that is linked to the form.

__________________________________________________ _____________

Also:

Is there a way to extend this example further by adding another combo box that takes the result from the first combo box to filter in values for the second combo box which will then automatically populate a text box which would then be stored in a separate table.

__________________________________________________ _____________

Someone kind of showed me before but they used unbound variables and this confused me as the combobox was unbound but how is that information stored into my table?

Pardon me for my redundancy but this is frustrating me to no end and I unfortunately have a deadline of today!!!! :(

I think it is the row source thing that confuses me. I take row source to mean where the data is stored. But where do you identify where to obtain the data to then store in your "inputed" table?

View 14 Replies View Related

Modules & VBA :: SQL String - Append Records From Table Into Another Table

Mar 21, 2014

I have a form with a listbox that displays the name of a table. Once the listbox item is selected, the table name is set to a variable called myFile. I want append the records from the table (myFile) into another table.

View 1 Replies View Related

Modules & VBA :: Searching For A Variable With Date Criteria In Table

Jun 14, 2013

I'm trying to search for a variable (varCod) in a table(SerialNumberCustomer) but I want to only store the returned variable in an array if its shipDate is between 9/30/2001 and 10/1/2012

this is what my code looks like so far:

Set rst = CurrentDb.OpenRecordset( _
"Select * from SerialNumberCustomer WHERE SerialCardId = " & varCod & " AND (ShipDate BETWEEN #09/30/2001# AND #10/01/2012#) ")

The line of code works and it returns all of the values in SerialCardId where it's = to varCode but it doesn't go through with the shipDate requirement. It's instead returning all of the dates with the found value.

View 13 Replies View Related

Modules & VBA :: Error 91 - Object Variable Or With Block Variable Not Set

Jul 8, 2013

Error 91 - Object variable or With block variable not set

I am getting this error telling me that an object variable is not set.

I know which variable it is but when I step through the debugger it sets the variable and all is fine? Issue is that public variable of a class is not getting set when the VBA Editor is not open?

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved