Modules & VBA :: Return Folder Directory To Text Box On Forms Record When Click Browse Command Button
Nov 12, 2014
I need to return a folders directory to a text box on my forms record called Files_Directory when i click the Browse command button... The folder will have more folders within it along with documents all relivant to the folder selected, hense the need for just the folder directory rather than a file.
Is it possible in access, to create a button that will copy a file to a new directory? Specifically, the data field in question is an access hyperlink that we can click on to open a PDF drawing of a part. I just want to copy the file the hyperlink points to, into a new directory.
If Me.Setfilter.Caption = "Search By Hedging Program" Then Me.Filter = "Hedging Program" Me.FilterOn = True cmd.Setfilter.Caption = "Don't Search By Hedge Program" Else Me.FilterOn = False cmd.Setfilter.Caption = "Search By Hedging Program" End If
Hedging program is the column from the table I am trying to filter, it is a yes/no column. I want it to return all yes values in my query if it says search by hedging program and if it says Don't search by hedging program I want it to disregard the filter. I also have it set so that when I click the button it changes the caption from one to the other. So I don't know if I really need the cmd.setfilter lines because they may do the same as my command button on click function.
Often I use Labels as buttons due to the fact I can colour them the way I want, and use the on click event to trigger code. The code below however works for a command button, but not a label button.
DoCmd.OpenForm "frmdatetime" Do While Forms!frmdatetime!OKFlag.Caption = "False" DoEvents Loop
When this code is run by clicking on a command button, it works fine. If run by clicking on a label, frmdatetime opens, but the mouse will not work on either of the 2 open forms unless you go down to the windows task bar, jump onto another window, and back onto frmdatetime. If I remove the loop with the DoEvents in it, then the problem does not occur.
Can anyone enlighten me as to why this behaviour occurs.
I'm trying to check a directory for a folder name which has a certain string in it (RecNum)
However the fso object filesys.FolderExists does not take an argument when looking for part of a folder name on a particular path.
What I basically want to do is look in a directory for a folder with the RecNum variable as part of the folder name. if it exists open it, if not create it.
Set filesys = CreateObject("Scripting.FileSystemObject") If filesys.FolderExists(targetdir) Then GoTo function_end MkDir targetdir If filesys.FolderExists(copypath) Then filesys.CopyFolder copypath, targetdir End If MsgBox ("folder created") function_end:
I have 3 attachment boxes in my table that appears in a form.each attachment box contains specific files (not specific as in extension such as PDF, JPEG, etc.) but specific as in Company Documents, Certifications, Resumes. The issue is there's a lot of document and I see my database growing (fast)...My question finally is....
Can I use a Hyperlink to open a folder within a specific directory where multiple file are located so i can open the specific file need there RATHER than attaching them in the attachment box individually?.?.....If not how this can be done (no SQL) unless that route is very simple and basic coding.
My thinking would be to place the file path to the documents in the table and hyper link that column in the table, but not knowing exactly how Hyperlinks work I don't think it would actually work..
I have access table that stores details as attached. Just to give an example how data is stored , I copied data from Access table to excelsheet. Now I would like to create a report that will run when a button is clicked on the form and the vba code should display the last 7 dates from todays dates in the report along with all the data and colour the record Green,Amber and Red depending upon the Update Date and Target Date. If the Target date exceeds then that records should be coloured "Red" and if todays date equals to Date then the record should be amber and if greater than Date but less than Target Date then it should be Green.
So the report should display the last 7 dates records from todays date and the appropriate color of each record to let everyone know if its under target, meets target etc.
I have a form where I want to browse for the directory path and display in a text box.I have done something similar to browse for file and display, but this time round I need only the directory path to be displayed .Need help on this.
I have created a form and need to be able to delete employees from a table. I built a command button using the wizard and this is the current vb code-
Code: Private Sub cmdDeleteEmployee_Click() On Error GoTo Err_cmdDeleteEmployee_Click
DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdDeleteRecord Exit_cmdDeleteEmployee_Click: Exit Sub Err_cmdDeleteEmployee_Click: MsgBox Err.Description Resume Exit_cmdDeleteEmployee_Click End Sub
But when I click on the button I get a message saying it would create duplicate data in the table.
I have this command button whose caption switches from update record to save record with a msgbox verifying if the person really wants to take this action. On click the user is then allowed to update the record then in theory they would be able to hit the same button whose caption now reads save record, the msg box would appear with a yes or no answer required. The code I have is putting the msg box after the user clicks the update button.
Anyhelp and/or suggestions would be most appreciated!
Private Sub cmdOpen3_Click()
stDocName = "frmSearch"
If cmdOpen3.Caption = "&Update Record" Then If IsNull(Me.FTMSubform.SourceObject) = False Then Me.FTMSubform.SourceObject = "frmFTMInfo"
If cmdOpen3.Caption = "&Save Record" Then If IsNull(Me.FTMSubform.SourceObject) = False Then Me.FTMSubform.SourceObject = "frmFTMInfo" If MsgBox("Save update to this individual?", vbQuestion + vbYesNo, "Save Update?") = vbYes Then DoCmd.Save DoCmd.Close acForm, "frmFTM" DoCmd.OpenForm stDocName Else MsgBox "Return to the FTMInfo Form!", vbInformation, "Save Function Aborted!" End If End If End If End Sub
(Referring to this post (http://www.access-programmers.co.uk/forums/showthread.php?t=75790) by ghudson)
Hi,
This post was very useful, it really helped me out, but I do have one question. My database will be used by multiple users and will be stored on a mapped network drive, just as the files that I want to link to. Now unfortunately not all machines are configured the same, so the same network drive can have different drive letters depending on the machine and this might cause problems. Is there a way to modify the code to get the absolute network path instead of the drive letter?
I am trying to filter a form by using two unbound text boxes that a user can enter in their criteria and then clicking a command button to filter the form using the criteria entered into the text boxes. My fields are as follows:
My form used to work and as I kept adding event scripts now when I click on the ID text field, it doesn't open the linked record, but a blank record with 'Filtered' showing on the bottom navigation. I guess a question I have is,
-is there an order on which the procedure scripts run -do they all run everytime, or just the specific event script
=================================== Private Sub Company_Click() DoCmd.OpenForm "frm Company", , , "[ID] = " & [ID] DoCmd.Close acForm, "frmCompanyDirectory" End Sub ===================================
I used to have code on a button on the "frmCompanyDirectory" that added a new record to "frm Company" and that's when the ID = ID stopped working.
I have a form named CORRES_TYP with 3 text boxes and a list box. I also have a separate table with 3 field from where the information I put in the form was saved.
In my form whenever I put information on the textbox at hit add record button, these information are saved in my table and will reflect on the listbox on my form below the textboxes. Also if I select a record in the Listbox the record I selected will apprear on the corresponding textbox in the same form.
My problem is that I have been trying to create a command button that will save and change the existing record everytime I select an item in the list box and modify the information through the textbox. Here are some infromation about my table and form:
Table name = CORRES_TYP Field 1 = CODE (Primary key, No Duplicates) Field 2 = DESCRIPTION Field 3 = FOLDER
Form name = CORRES_TYP Textbox 1 = CODE Textbox 2 = DESCRIPTION Textbox 3 = FOLDER Listbox name = LIST14
I have created Command buttons on forms with VBA code. Records GoTo previous and GoTo Next Record so both of working is good. But Next Record command is force to a new record. If suppose when we clicking on last record. It is go to new record without any message. So No need to force a new record with Next Record Command. Only just move to next record if there is no records show a message. Below mentioned both VBA codes so there is any changes on GoTo Next Record Code?
VBA Code: Go To Previous Record : DoCmd.GoToRecord , , acPrevious Go To Next Record : DoCmd.GoToRecord , , acNext
I am designing a database to manage hospital patient data. I will have to enter info at various points, e.g. when a patient is referred, admitted, discharged...
So for example, I have a main form with the patient's name and two subforms, one with the referral details (e.g. date, name of referrer...), and one with the admission details (e.g. date, diagnosis). They are linked through Parent-child links to the main form by PatientID. So, when I enter a new PatientID in the main form, the ID in the subforms is automatically added/synchronized.
However, I would like it not to be...since not all patients that are referred are then admitted. Therefore I would like to have a command button in the main Form that allows me to control when a new patient record is added to the admission subform. In other words, I would like an "Add a new Record in the admissions subform" button, which then creates a new record, with matching PatientID in the admissions subform (and in the related table). Is this possible???
I have tried using the command button wizard but it either requires a record to be already present in the subform, or it takes me to the first record of the form, and not the matching PatientID one.
I'm having a small difficulty in using the code example ghudson posted for Browse [Find a directory or file]. First off, the code works great. Thanks a lot for posting it!
The problem I am having is when linking a folder via dBrowseDirectory. The folders I am linking are on a shared network drive and I am trying to figure out how to set the initial directory to default to the networked PC. This way the user doesn't have to navigate to the shared drive every time. All they would have to do is navigate to the particular folder to link (2 clicks instead of 10+).
The dBrowseFiles function allows to set an initial directory, however I cannot figure out how to set it for dBrowseDirectory. Is there any way to do this by altering your code for dBrowseDirectory?
I currently have a database where new records can be entered in a "New Part" Form and Records can be viewed(but not altered) in a "Part Search" Form. The forms are the same except one is allowed to edit. I have also created another form where I am trying to search the "Part Search" Form via a tracking number. I want to have a text box where users enter a tracking number then click the button to take them to the record on the "Part Search" Form.
I've rebooted my copy record button and just used the macro wizard for now, it seems to work as far as I can tell but there is something strange about it.
I've added in some text boxes so I've got some confirmation, but when I click this copy button I get the following error;
"The command or action 'RecordsGoToNew' isn't available now."