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
I have managed to populate a treeview with some menu items I required and it looks great but I now need to get it to do something. How do I get a tree view value (selection) to act as a variable in routine. e.g. if my tree look like this.
Menu ¦ - Compaint management I I----My compaints
When I "double click" on My Complaints I want it to a open a specific form. One I know how to do one action I should be able to figure the rest out for myself.
Am looking to do a treeview type of search to hyperlink to client file/folders on my network. This way I can hide the main file source location in the network and files can just be accessible via Access program search.
So far I found this link [URL] and the 3rd bottom option seems to be the most promising but I cant seem to figure how to accomplish the hyperlinks.
I have a button on a form and I want the On Click event behind it to check whether Shift is also being pressed when the user clicks the button (or Ctrl, or Alt, in fact any damn key will do).
I can't believe that there isn't a function in VBA like the old 1980s BASIC 'inkey' function (etc) that just simply returns the code of any key being held down at the time of the scan. I shouldn't have to mess around programming other events like KeyDown and KeyUp when I don't particularly need the key-press to trigger an event per se.
I want to handle the event when I right click and choose "Paste" to pop up a message to the user that he cannot paste; disabling the pasting functionality.
I understand that the Button parameter refers to right or left button , but on which event to best use (mouse up ,mouse down , mouse move - as it seems to be a mixture of the three) and the code for that event.
Code: Private Sub List_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) ' See if the right mouse button was clicked If Button = acRightButton Then 'DoCmd.CancelEvent 'do event here End If End Sub
I don't want to cancel after there is a right click , but rather after right clicking and choosing "Paste".
I'm currently trying to make the call answering screens a bit better in the call centre that i work in. i'm trying to make a caller i.d. for incoming calls. i have a reference library from the telephone software people in vba that lets me dial and hangup the phone, now i'm trying to place a text box on the form that will update to show the number of an incoming call which will enable me to search a table of contacts and display the details of the caller if they are available. i'm guessing that i need to create a loop that will run until there is an incoming call but i don't know where to place the code without it needing a mouse click or mouse over to trigger it. i just want it to run constantly.
I have a form (about patients) containing a listbox (list of visit dates) and a subform (showing medications at that date). When you click on the listbox, the subform is re-queried with the selected date as a parameter to show the medications that were in use on that date. This is working fine.
However, when you move to a new record (patient), the subform is initially blank because the listbox hasn't been clicked on yet. This means that it looks like the person isn't on any medications, which is causing some confusion.
I need a way to have the subform show the "top" (most recent) date because that is the current medication list, and the thing most people want to see first. It is always the top of the list, so I would like to do something like this (pseudocode)
Code: Private Sub Form_Current() Forms![MedSearch].SelectDateBox.Requery Send MouseClick Event to line 0 of SelectDateBox End Sub
In the Main Form , I have few buttons and I am writing the following code to open the right form when a button is clicked but unfortunately the code isn't doing anything. No form is opening. I am using MS office 2010.
Code: Private Sub BtnOption_Click() DoCmd.OpenForm "Form1", acNormal, , , acFormAdd, acDialog End Sub Private Sub Form_Load() 'Me!Label1.Caption = "Welcome " & Environ("username") & "!"
I have some code for a button on click event to open a form and select the record which corresponds to a value in an unbound text box. The code is:
Private Sub Command25_Click() On Error GoTo Err_Command25_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmOpenPatientRecord"
[Code] ....
This works fine when I put in a 10 digit NHS number but opens a blank record when I enter a four digit or six character/digit PatientNumber. Both patient number and NHS number are text fields in the underlying table.
I work for a company that manufactures home appliances & electronics. When those products fail within the warranty period, we are obligated to repair the units for the customers.
We have around 200 factory technicians who make those repairs. Each tech is able to make approximately 8 repairs each day. We have a dispatching system that assigns the repairs to the techs based on their availability each day. But the problem is that we have to manually enter and adjust the schedule for all 200 techs every single day, and this takes a lot of time. And of course technicians get sick, take vacation, etc, so we have to adjust the schedule so no techs will be assigned calls when they're off.
The problem: For example, currently when a technician takes off for 2 weeks, the user has to enter 14 individual records for the tech, which is somewhat time consuming. What I need is to program a button click event to determine the two dates (startDate & endDate) and append multiple records from one single entry in the form for each date in between and including the two date fields.
I know I'll probably need to create a loop that will loop through the two dates on the form and append a record for each day, so I can then cross reference the dates to the master schedule dates to make sure that no availability is opened for the techs taking time off.
I have an access form which i have turned of menus, navigation and shift key. What I am looking for is to have buttons on my form to allow users to create and delete queries from my form. I already have a listbox that shows all the queries and runs them when a user double click on them.The codes needs to run in access 2007-2013 in both 32 & 64 bit versions.
I have a report that tracks scores for our employees. From the report, you can click a button to add a new score in a form or edit an existing score(frmscoretracker). On this form there are two subforms, in a tabbed control to track additional information about the score; what areas were marked down(Trends), and was it a failing score(AutoFail).
When this form opens I have it programmed to only show the subform if there is data in it. The goal being, if I am adding a new score and there is no existing trends or Autofails for this new record, neither subforms will show - I will add an after update even to show either trends or autofail depending on the score recorded. Also, if someone chooses to edit the score, whatever subform with data, will show as well.
When someone clicks to add a new score, opening this main form to a new record, both of the tabs show. However, if the form opens to an existing record, the appropriate tab shows. Here is the code
Code:
Private Sub Form_Open(Cancel As Integer) 'If the subform has a record, the tab is visible, if not, the tab is not visible If Me.frmtrends.Form.Recordset.RecordCount > 0 Or IsNull(Me.Trends) Then Me.Trends.Visible = True Me.TabCtl33.Visible = True Else Me.Trends.Visible = False End If
[code]...
Both tabs are set as not visible in the default settings. Is there something in this code that is triggering then to be visible when there is no record in the main form?
My idea is to have a field in my table that have ratings for example - 1,2,3,4,5,6,7,8,9,10. How can i make one star.jpg image to appear when I've entered rating 1, two stars to appear when I've entered rating 2, 3 stars for rating 3 and etc.... Is that even possible? If it isn't is there any other way i can make this?
I am trying to make some folders from a Query list to my C drive.I found this code for making folders. I have a button on a form with this code. It works with making a folder but only gives me the first item in the query out of many rows. It is missing the rest of the items.Also I would like it to be able to make Sub Folders too from this query.Here is the code I found.
Private Sub MakePreservationTagFolder_DblClick(Cancel As Integer) Dim strFolder As String strFolder = "C:UsersryanDocuments" & "Tag - " & DLookup("[Tag]", "Tags Qy")
I have the below code to create email and folders based on data from the database. For now, I'm able to create the main folder and add a word document inside. What could be changed on the code or added to add 2 sub folder named "Documents" and "Correspondence"
Greetings.
Code: Option Compare Database Private Sub SendEmail_Click() On Error GoTo Err_open_word_Click
the code below sends 3 reports to a folder that the vba creates if needed. I would like to change it so the 3 reports go to different folders and creates a folder with the customer name in each of the below folders if needed at present it looks table with one folder address is as I dont know how to make it look up the 3 different records in that table so I would like to just put the 3 folder address in the code
I have over 500 folders that contain XML files in each folder. I need to go through each folder and append the data from the XML files into my database.
I'm using a function to find all files/folders in a specific directory, then copy each one to a specific destination folder. I'm going to use this on a weekly basis to backup files on a computer. I would like to use the vbarchive in GetAttr/SetAttr so I only need to copy these if they have changed since last backup.
Something like:
If GetAttr(strFile) And vbArchive = 32 then filecopy xxxx, xxxx else rs.movenext
As I understand it, a value of 32 indicates that the file has been modified since it was last backuped up (i.e. since the file attribute was "reset"). How do I "reset" the file attributes to clear the vbArchive?? I've read some google searches and the only thing I could find was the files were set to vbnormal however I'm concerned that this will erase program files that are vbReadOnly or VbHidden.
I'm working with a database with employess info in access, When I click on an employees name in a form, I want to fire off another form with there info, what I have now it does nothing.
I have a list box control on a form and i'd like to set up a right-click property. Can this be done at all? When I open the Events tab on the property window..there is no right-click property :confused:
create/find code that will count the number of text files in a directory with one level of folders please see below:
Directory path is : B:
First and only level of sub folders:
there are 100 of these and they all end in ".fof"These .fof folders will always contain .txt files.I've tried using the following code, but it always returns No files found.
Code:
Dim lngFileCount As Long Dim StrFileName As String StrFileName = Dir$("B:*.txt") Do While Len(StrFileName) <> 0
How can you disabled a click event on a text box ? I don't want to use ENABLE = false because the background of the texte box comes gray. So, any alternative solution?
I'm trying to code an event that would occur when a user double-clicks on the Record Selector of a subform. I want it to then open a form that would provide additional details about the record selected in the subform. I can't find documentation to tell me (1) where to put the code, i.e. subform double-click event vs. subform detail double-click event, etc.; (2) how to reference the record id of the selected record for use in the filter for the form that is going to be opened (the underlying query contains the ID for the record). Can anyone help or point me to documentation?
I have a form which has a tab control on it. The form itself is based on 1 table (tblCustomers). The tab control has 2 pages.
Page 1 shows 6 fields from tblCustomers.
Page 2 of the tab control shows 2 embdedded forms. Those forms are based on queries created from tblCustomers. one shows records with a date entered into one of the fields, the other shows records that have no dates.
What I want to be able to do is when I see a company name in one of the ebedded forms (Page 2), I want to be able to double click that record and it switches me back to Page 1 and shows the the related details of whichever company I double clicked.
I have changed the double click event in the emdedded form and using the builder to create something. I also added a setfocus command as I read about that somewhere (but i have no idea what it does). Through this I managed to get it to switch from Page 2 to Page 1 when I double click, but it only ever takes me to record 1 regardless of which company i double clicked.
i may have this deisgned totally wrong so please feel free to point me in the right direction.