Modules & VBA :: Test If Main Folder And Subfolder Exist

Mar 1, 2015

I'm having problems creating a second subfolder in the main folder.

The main folder is used to keep inside the reviews of clients inside.

The code I have now, will only create a main folder if it does not exist and then a subfolder with the BIN nr, type review and date. If the client would have a diferent ones and in diferent years. So if it has first "Prototype Model", the next one could be "Prototype Review". The part of the code that checks if the main folder exist works, but how to let the code create in the main folder the second review subfolder? Please see below code I managed so far:

Code:
Private Sub btn_Create_Folder_Click() 'XXXXXXXXXX working onXXXXXXXXXXXXXX
Dim path1 As String
Dim path2 As String
path1 = "C:Test_FolderMedium" & Me.BIN & "_" & RTrim(Me.LE_Name) & ""
path2 = "C:Test_FolderHigh" & Me.BIN & "_" & RTrim(Me.LE_Name) & ""

[Code] ...

How to have the code test both of them?

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

Modules & VBA :: Open Folder Nested Inside Main Folder?

Mar 16, 2015

I'm trying to open a folder based on a BIN nr. This folder could be in a main folder that has diferent subfolder. As there where differnt naming used to create the folderes, one of the things they have always is the BIN nr. It alwasy start with a unique number and maybe I could use it to scan the subfolders and open that one that the BIN nr is equal as in the field BIN.

Now we have serveral 1000th of folders and finding them takes time.

View 3 Replies View Related

Need To Display A List Of Folder/subfolder Contents

Nov 15, 2006

In access, I need a way to display a list with folder contents, for example...

Folder1
subfolder1
file1
file2
subfolder2
file1
Folder2
subfolder1

etc

View 1 Replies View Related

Does A Folder Exist

Feb 21, 2007

Hi,

I've got an Access 97 piece that imports text files, copies and moves the used files and several other things.

I've now been asked to enable it to create a fairly complex folder structure.

I've done that, but I'd like to be able to issue a warning if the root folder already exists, can someone please show me how to check if a particular folder exists (I don't particularly care if its full or empty).

View 3 Replies View Related

Modules & VBA :: Test String Test Based On Table Data

Oct 31, 2013

my issue is i have multilble text box in my form & based on change in one of this text box i need the code to compare between data in the form & table & returm Msg if it is not matching. attached screen FYI.

i look in the internet but i could not figuer out the VBA code since i do not know VBA. what comes to my mind to to use select case.

View 14 Replies View Related

Modules & VBA :: Create Subfolder And Copy File - Path Is Variable

Apr 18, 2014

I have a folder which holds 1000s of pictures organised in subfolders, for example:

D:~AI Database Print Scans2009family and
D:~AI Database Print Scans2009holiday

And so forth. In total at the moment 17 main subfolders, each of which hold another 2-3 subfolders.

I am putting together a database to bring pictures together with all sorts of details. I import the picture via hyperlink and complete the various fields. All that works fine but there are a lot of pictures! And it gets confusing to see which ones have already been entered into the database and which ones haven’t.

One solution for this is to copy the pictures that have been “completed” to another folder. I have found a way to do that:

Dim fs As Object
Dim oldPath As String, newPath As String
oldPath = Forms!frmPrintDetails.txtPath1
newPath = "D:~AI Database Print ScansCompleted_Entries"
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile oldPath, newPath
Set fs = Nothing

Works fine, but the problem is that I loose the subfolder structure, it copies all pictures to the same main folder. I’d like to maintain the subfolder structure and add code to create the correct subfolders and next copy the picture. With the different paths I’m lost. I don’t know how to extract the correct path in code. I’d also like to either rename or remove the picture once I have completed entry of the details. The problem I have again is that I don’t know how to code for a changing path.

View 12 Replies View Related

Modules & VBA :: Copy And Rename Excel File To Subfolder With Name Entered In Forms Control?

Jan 5, 2014

I am still trying to copy an Excel file from a parent folder to a sub-folder, that this code creates, and name the copied file with the name used to name the sub-folder, using the name entered in a control field (named 'TheDirName) of an Access 2007 form. Here is my VBA, which names the copied file "TheDirName.xlsx.:

Private Sub MakeDir_Click()
Dim appExcel As Excel.Application
Dim lngLastDataRow As Long
Dim Folder_Path As String
'Create path for customer folder & files

[code]....

View 3 Replies View Related

Moving Documents Associated With One Customer From Main Document Folder To Another

Jan 28, 2015

I want to move documents associated with one customer from my main document folder to another. I've looked at some sample code but nothing seems to work

I want to run a query to get the document list

Run the code to move these files ( PDF Files )

and It's done...

View 14 Replies View Related

Modules & VBA :: Test If Form Field Fits Within Range Variables

Mar 4, 2014

I have an Access form that gathers students test scores on Reading & Writing exams. Depending on those scores, there are five possible classes for them to be assigned.

I have the intervals worked out, and have created a table that contains the min reading, max reading, min writing, max writing, and class they belong in.

As follows:

tblEnglishPlacement

readMin readMax writeMin writeMax englishPlacement
0 99 0 5 Eng1
55 69 6 6 Eng2
70 99 6 6 Eng3
0 69 7 99 Eng4
70 99 7 99 Eng5

The scores are entered into a form as scoreReading & scoreWriting (integer)

I'm trying to figure out the best way to pull and compare the values and return the proper englishPlacement text. Its set up this way because there are multiple tables to pull from, depending on the date of the exam. Each table has different ranges for each Eng1,...,Eng5.

I'm thinking perhaps to iterate through each column and evaluate T/F, then return the englishPlacement value of the correct row. I'd like to keep this stuff in the VBA so that the code to select a table based upon date doesn't break when the intervals inevitably change requiring an additional table.

View 2 Replies View Related

Modules & VBA :: Generate Report For A Test And Answer Sheet - Setting Title?

Oct 15, 2013

I'm using VBA code to open a query, generate a report for a test and an answersheet. I'm using the same report, and don't want to make many reports. I have the below code which runs my query, and generates the reports.

Private Sub Command2_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "1", acViewNormal, acEdit
DoCmd.OpenReport "WrittenExam", acViewPreview, "", "", acNormal
DoCmd.OpenReport "WrittenExamAnswerSheet", acViewPreview, "", "", acNormal
End Sub

I have a need to be able to set the report title for both reports when running my code.

View 3 Replies View Related

Modules & VBA :: Check If Multiple Values Exist?

Jun 17, 2014

I am making an asset table which amongst other fields have fields for "serialNo" and "Manufacturer"

I am trying to write some code that after update of manufacturer in the form, will check to see if that serialNo and Manufacturer exist.

ive managed to do it for one value, using

If Not IsNull(DLookup("[serialno]", "Assets", "[serialno] = '" & Me!serialno & "'")) Then
msgbox "blah blah"

which works great, but am struggling when i'm asking it to lookup two values.

View 9 Replies View Related

Modules & VBA :: Random Test Generator Which Pulls Records Based On Category From Table

Oct 3, 2013

I'm having trouble with my VBA module.I have a random test generator which pulls records based on a category from my table into a temp table using a make table query. I use the following code:

Private Sub Command2_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "1", acViewNormal, acEdit
DoCmd.OpenReport "WrittenExam", acViewPreview, "", "", acNormal
Reports!WrittenExam.lblTitle.Caption = "Exam Name"
DoCmd.OpenReport "WrittenExamAnswerSheet", acViewPreview, "", "", acNormal
Reports!WrittenExamAnswerSheets.lblTitle.Caption = "Exam Name - Answer Sheet"
End Sub

My querry makes the table, and then generates two reports (my exam, and the answer sheet). I'm getting an error 3211, saying the temp table is already in use by another process when trying to generate both reports. I used a Macro before, but I have a need for custom report headings, so I'm using VBA.

View 1 Replies View Related

Modules & VBA :: Check If File Exist On HTTP Server

Sep 13, 2013

I found and modified this code to allow me to check (fast) if a file exist on a http server or not (without downloading it).

Code:
Public Function CheckNetFile(WebFile As String)
Dim XmlHttpReq As Object
Set XmlHttpReq = CreateObject("Microsoft.XMLHTTP")
XmlHttpReq.Open "HEAD", WebFile, False

[Code] ....

In the above code I managed to declare Webfile as a string so I can call on it later but one thing I still need to tweak is to also get a result out of the test code in a better way than having to publically declare the "CheckNet" variable somewhere else in my app.

First prize would something like this:

If CheckNetFile ("http://www.mysite.co.za/test/test.txt") = 1 then "Yes" else "No"

How do I build the 'booleon check' into the original function?

View 5 Replies View Related

Modules & VBA :: Email Attachment - Path Does Not Exist Or Is Not Valid

Feb 14, 2015

I want to do it bring up a form from which the user can send an email, and on the form is an unbound text box [Text1] in which the user can paste the attachment path.

Code:
Dim olApp As New Outlook.Application
Dim mItem As Outlook.MailItem ' An Outlook Mail item
Set olApp = CreateObject("Outlook.Application")
Set mItem = olApp.CreateItem(olMailItem)
' Add the To/Subject/Body to the message and display the message

[Code] ....

So, when I paste the file location into Text box [Text1] I get the Run Time error that the path does not exist or is not valid. Yet when I use the next line which is the same path, all is OK.

View 8 Replies View Related

Modules & VBA :: Viewing Values That Exist In Table TblTest2 To User?

Aug 5, 2013

I'm having trouble viewing values that exist in table 'tblTest2' to the user. The first set of code (below) doesn NOT work. Yet the second set of code (all the way at the bottom) DOES work. And by work I mean that it erases the old values and only puts the tblTest2's new values. The first set of code has values but they are not the right ones. The second set of code has the correct values for its statement...

Code:

strTable = "tblTest2" 'Table for storing values for viewing purposes
DoCmd.DeleteObject acTable, strTable 'Delete tblTest2 old values
CurrentDb.Execute "CREATE TABLE tblTest2 " _

[Code].....

View 11 Replies View Related

Modules & VBA :: Runtime Error 2580 - Record Source Does Not Exist

Jun 9, 2015

I currently have this set as the forms default recordsource (which works just fine):

Code:
SELECT TOP 5 tblUsers_Phone_Book.EMAIL_ADDRESS, weightedDL('me@mine.com',[EMAIL_ADDRESS]) AS Expr1

And I have this vba to dynamically switch around that email address.

Code:
Private Sub Form_Load()
Dim intPos As Integer
Dim strControlName As String
Dim strValue As String
Dim sSQL As String
If Len(Me.OpenArgs) > 0 Then
' Position of the pipe

[Code] ....

If I msgbox the sSQL - it shows identical to the default recordsource but I get the error:

The error message I get is:

Run-Time error '2580'
The record source 'SELECT TOP 5 tblUsers_Phone_Book.EMAIL_ADDRESS, weightedDL('me@mine.com',[EMAIL_ADDRESS]) AS Expr1' specified on this form or report does not exist.

I tried copying the exact working default sql into the vba and get the same result.

View 3 Replies View Related

Modules & VBA :: Insert Two Values From A Form In Table And Check If They Already Exist

Jan 27, 2015

I'm trying to write some Code with the target to take a value from a textbox (out of a form) and a pregiven value (in this case = 2) and enter them in a new record in a table. But only if there is not already a record with the exact same combination of these to values. When done, the same button should proceed you to the next form (but this code is not already implemented in the fragment below) even if no values are added because they already exist in this combination.

Code:
Public Function GetID_PatientStudiesGroup&()
GetID_PatientStudiesGroup = [Forms]![frm_PatientStudiesGroupTZP]![ID_PatientStudiesGroup]
End Function
Private Sub BPRS_T1_Button_Click()
Call GetID_PatientStudiesGroup&
Dim strSQL As String

[Code] ....

As you can see, I tried to use a function to refer to the value out of the form, because I didn't find out how to refer to a form in an SQL Code.

Just to give you a better overview: The table where the information should be added is named "tbl_PatientStudiesGroupTZP". The form where you find the Textbox "ID_PatientStudiesGroup" (with the value I need to transport) is named "frm_PatientStudiesGroupTZP". Every part (except the WHERE NOT EXISTS part) worked perfectly for itself, but not when thrown together.

View 10 Replies View Related

Modules & VBA :: Checking If Data Entered In Form Field Exist

Jan 17, 2015

I want to check if data entered in a form field is existed

The form is bounded to a table

I used this code

If DLookup("Telegram_Number", "tbl_Violation_Of_Building", "Telegram_Number Like " & Forms!frm_Add_Violation_Building!Telegram_Number) Then
MsgBox ("number existed")
Me.Telegram_Number = ""
Else
End If

everything is ok but if the data is existed the database show the message and clear the field but i'm getting a Run-time error

'-2147352567(80020009)': the macro or function set to the beforeupdate or validationRule property for this field is preventing [ISF] from saving the data in the field

I guess the problem because the form is bounded to a table so he will save automatically

My solution is to unbound the fields and save the data via vba but is there any solution with a bounded form???

View 3 Replies View Related

How To Open A Dialog Box To Move Files Inside A Folder That Is Setup As Current Folder

Sep 2, 2015

I'm trying to automate a process of selecting a set of file/s and move them in a folder. When I click on a button, it should open a current folder that is setup in the code.

Lets say that I have a folder C:documents est, and very time I click on the button, it should open the dialog box with that path so I can select the files from another folder, drag them there and they will be saved in that folder.

This will form part of wider automation that will send an email stating that those file/s where placed in that folder.

I have in the same form where the button is placed, 3 check boxes that needs to be passed to the email as well that one or all the files where placed in the folder.

View 10 Replies View Related

Modules & VBA :: Error 2391 Field F1 Doesn't Exist In Destination Table - Access 2013

May 3, 2014

I'm getting error 2391 field 'f1' doesn't exist in destination table

Code:
Dim FileBrowse As Office.FileDialog
Dim varFile As Variant
Dim sFile As String
Set FileBrowse = Application.FileDialog(msoFileDialogFilePicker)

[Code] ....

View 1 Replies View Related

Modules & VBA :: Up One Folder In FilePath

Jan 24, 2014

FilePath = CurrentProject.path

I am currently using this path, but I moved my database folder into another folder so people won't mess with it. I still need to create files to the original directory. How can I make the FilePath still relative but up one folder from CurrentProject.path?

View 5 Replies View Related

Modules & VBA :: Merging All PDF Files In Particular Folder

Oct 25, 2014

I'm trying to write a simple little database. At one point on a form, I'm trying to merge all the pdf files in a particular folder. (I'm using the pdftke.exe program and there will be multiple pdf files)

It all works perfectly if I call it as below, with the actual paths already hard coded. It combines all the pdf files and renames it to the "merged filename.pdf" correctly

Dim stAppName1 As String
stAppName1 = "C:a folder namepdftk.exe C:another folder nameprints*.pdf cat output C:folder where merged file will bemerged filename.pdf"
Call Shell(stAppName1, 1)

However, I'm trying to have it work with the middle portion (the folder where all the pdf files are) being created on the fly so to speak.

The middle portion/path I have stored from a previous form and it's stored in a table.

So I'm trying the below, but doesn't seem to work.

Dim stAppName1 As String
Dim combine_files As String
combine_files = (this pulls a path from a stored field on the open form) + "" + CStr("*.pdf")

stAppName1 = "C:a folder namepdftk.exe (combine_files) cat output C:folder where merged file will bemerged filename.pdf"
Call Shell(stAppName1, 1)

With the code above, it doesn't seem to do anything.

View 2 Replies View Related

Modules & VBA :: Loop Through All Files In Folder?

Aug 26, 2014

I believe this is most recurring scenario for all. Any simple way like:

Code:
For each file in folder.files
Msgbox File.Name
Next File

For your information the above code doesn't work

View 10 Replies View Related

Modules & VBA :: Copy File From One Folder To Another

Feb 28, 2014

I need to create a function that I can launch using a macro that will copy an excel file from one folder to another in the file system.

View 4 Replies View Related

Modules & VBA :: Move Entire Folder

Dec 12, 2014

I have a form which has a field called quote directory, this contains the path of the quote documents and sub folders, I also have a field called project directory.

When a quote is confirmed I have it all working so a new folder is created with specfic details like project number etc.What I want to do is move the folder from the quote directory and put it in the newly created folder in the project directory.

View 2 Replies View Related







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