Creating A Directory Structure Using VBA And Form
Nov 9, 2006Hello,
Just want to know how to create a directory structure using VBA and a form in Windows explorer, thanks for any help...
Hello,
Just want to know how to create a directory structure using VBA and a form in Windows explorer, thanks for any help...
Hi Guys!
How would I make a copy of my Database, but only copy the structure and not the data.
I know that you can do this with tables (Copy, Paste > Structure Only), but can you do it with the whole DB?
Cheers!
I have 12 folders (User1 - User12) located in "c:users..."
When I select a UserName from a combo box in a form e.g. User3 , a list of all files with extensions ".doc" in the respective directory (c:usersuser3*.doc) should render with a hyperlink to the file / s.
I have tried variouse "Select Case" and "FileSearch, FoundFiles" scripts, to no avail.
Any assitance would appreciated.
Current Version: Access 2000
I have a form from one of the gurus on site and I have tried to tweak the code to show a directory per record (Access2000) Its half working I open up the form and get "13- type mismatch"
vDir seems to be empty (I have pt a file in their to veiw)
running the cursor over QteNo & qteinsnme - both have what I expect in them (A number and a name respectively)
howver Vir seems to be empty and when i debug it oes straight to "Resume Exit_FilesAndDetails) second from bottom line of code copy code below
Private Function FilesAndDetails()
On Error GoTo Err_FilesAndDetails
Dim rs As Recordset
Dim vDir As Variant
Dim sPath As Variant
sPath = "C:Coverex international" & "Forms!main!QteNo" & " " & "Forms!main!QteInsnme" & " "
'Const sPath = "C:Coverex international(Me!QteNo)(Me!QteInsnme) """
' Const sPath = "C: emp" 'sPath must end with a back slash, sPath = "C:Windows"
CurrentDb.Execute "Delete tTempFiles.* from tFiles;"
Set rs = CurrentDb.OpenRecordset("tFiles")
vDir = Dir(sPath & "*.*")
Do Until vDir = ""
rs.AddNew
rs!FilePathName = sPath & vDir
rs!FilePath = sPath
rs!FileName = vDir
rs!ModifiedDate = FileDateTime(sPath & vDir)
rs!FileSize = FileLen(sPath & vDir)
rs.Update
vDir = Dir
Loop
rs.Close
Set rs = Nothing
DoCmd.Requery
Exit_FilesAndDetails:
Exit Function
Err_FilesAndDetails:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_FilesAndDetails ******yellow highlight here
End Function
I'm trying to tie a from into the results from and AD Query. I'm not that experienced with doing this kind of thing so I may be going about this the wrong way. Anyway here's what I've got so far:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
With cn
.ConnectionString = "Provider=ADSDSOObject;Trusted_Connection=yes;"
[Code] .....
When stepping through the code, it all goes well until it hits the line that actually connects it to the form "Set Me.Recordset = rs".
When this line is executed, Access crashes and attempts to restart.
PS: Access 2010, Win7 64bit
hello all, I am very new to access (my background is in VBA Excel, but I am not using VBA for access yet).
I was wondering if some of the more advanced people can give me pointers on how to accomplish (or work my way) to make the kind of form I am trying to do.
What I am trying to do is the following:
I have a vending company with couple of products such as espresso, latte, black coffee, etc.. (all of the products are sold at the same price for each customer, so I might sell the products for company A for .75, but for company B for .55 etc) and I am selling these products to many clients company A, B, C, D, etc. As A start I created a table with my products, then I created a table for my clients (this one includes name, address, contact person, and machine number ).
I would like to make a readout input form where it would get the customer name, machine number, each of the product's total for the readout period (this is usually every week), and the date of the readout. Now I would like the form to add a record in a table for the client machine number that was selected and maybe also in another table for the overall machine ( I am not sure how queries work, and weather I would need that or I can use queries for it).
My ultimate goal is to be able to do the following with the data:
- check (and perhaps graph) the overall statistics for a each of the products for all clients
- do the same for a certain client
- do the same for a certain machine at a client
- check the overall sales of all products to all clients for each month of the year
- do the same for a particular client or for an individual machine
- do the same but for each year
I have done all of this in a VBA Excel based program but I was hoping to change the program to be access based instead of excel based, since this would make the data more centralized and easier to maintain, backup, check, and update.
So if anyone can post any hints or suggestion about how I should build my tables, the usability of quarries, and especially the construction of the forms I would very much thank you for that, since these are my first days getting to know access and I am absolutely confused with it, all the language you are supposed to put into text boxes, combo boxes etc....
Also if anyone knows of any good links to some online tutorials would be great, since most for the tutorials I found on a search was for constructing a for or a query using the wizard, but with no real discussion of how to bound the data to certain fields etc.
Layth
I thank you all in advance.
Can you use a VB6 directory listbox control on a MS Access form to display the directory structure? If so, how do you do it?
Or is there some other way to display a user selectable directory structure on an Access form?
Thanks
tw
Hi All,
I've been trying to use TreeView control to display my computer's directories and folders just like Windows Explorer does.
Thanks to Popeye for reposting all the Treeview samples (samples posted before the site was hacked). Most or all of these samples, TreeView is used to display data out of tables. Mr. Ghuson posted a great example for browsing directory but it pops up a separate windows for browsing.
Now I'd like to somehow combine the two into one; browsing thru directories and folders using TreeView Control. Yes that I can browse and save all paths and directories to different tables and add them to the TreeView control but I'm trying to stay away from saving data to tables first.
Can this be accomplished? Can Windows Explorer be somehow embeded on an Access form or called? Any ideas, experts out there?
Thanks all in advance.
Anyone got any ideas how to get the directory path where the database is running?
Thx in advance
Bob
I have made an Access database containing contract names and addresses. I need to have each of these contracts linked to another table which shows the allocated engineer for the particular contract. I used a "one 2 many" relationship using a field "LinkID" to do this. Each engineer has a unique "LinkID" in the engineer table but the engineer changes each day. The engineer for each particular day comes via an excel spreadsheet. The way it works at the moment is that the engineer name has to be manually changed each day, and this takes time. I have tried importing a linked excel table which looked like it would work, but was not able to use the linked table in the same "one 2 many" related table format as above.
What i need to do, is find a way for the fields containing the engineer name to be automatically updated somehow, possible by reading the values from the excel sheet.
Anybody know of any way for this to be done?
Thanks, and hope this makes sense got its got me baffled.
*** Edit **** Thinking about it, i could have an imported execl sheet which contains all of the engineers for each day. Would there be a way using a macro, to update the data in the engineers table that is related to the contracts, by overwriting it with the data from the linked spreadsheet?
Hi,
In MS Access,
DoCmd.OutputTo acOutputReport, "Appr", acFormatRTF, "P:Appr.rtf", False
I want output the file in the current directory,
the above code is specific the path,
how can I edit the current path, so whereever the the database is either drive, they still can work.
The concept is like that
DoCmd.OutputTo acOutputReport, "Appr", acFormatRTF, currentdirectory:"Appr.rtg", False
Please let me know, thanks.
Hello Access gurus
I hope I am in the right place to start this off
I had D/b all set up but i need to have on my form a view of directory(s)
I have button that creates the folder (many thanks to the person whom gave me this )
but what i want to be able to do is preview this witihn my form
so on my form I want a box that will show what i have stored in this folder (which could be word or pdf or xls)
my button will create C: empfiling filenumber & filename ( about 20 chars)
so my form need to be able to preview all files within this folder ( I hope that I have at least half way explained what I am after
Access 2000 - and reasonable expereince (not brillaint at advance VB )
any thoughts regards
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.
View 1 Replies View RelatedIs there a way to make a directory box, like you can find invisual basic, that you can dynamically search folders for files?
Thanks
I'm hoping someone can help me with this.
I would like to be able to provide a directory search form in my database. This is to enable staff to locate files that they would like to attach to the report they are submitting.
I don't seam to be able to find a control to do this.
We have Access 2000
Any help sample code ect would be appreciated.
Thanks in advance
David
We decrypt about 130 different files into an internal directory by using code that was created in Access 2010. I would like to open that directory with the files that were decrypted for that day so the user can confirm that the process was completed. I use the Shell command throughout the code but I cannot figure out a way to open the directory.
View 1 Replies View RelatedHi All
I have a small Help Desk db with tables that contain computer spec and user information. But I already have all this information in Active Directory and it seems pointless entering the information twice.
Is there any way i can get the database to lookup the information from Active directory i have no idea where to start.
Thanks
Hi, I wish to open a folder/directory (not a file) using the onclick event of a cmdButton. Any ideas out there?
Robb:D
Hello, I have a VBScript that when clicked on opens the command prompt and fires code to upload a query to my website.
What I would like to do is place a command button on my form that will call the script to run instead of having to go and click on it.
I have searched, maybe using wrong terms, but havent been able to get the right code to do this
any help to call this script from a command button would be appreciated.
Hi,
Having recently correlated the impossible pile of photos that I have on CD, including a lot of re-naming etc... I have now managed to get them down onto DVD.
I there an easy way to import a directory listing into an access database other than inputing the lot by hand? I don't wan't to add thumbnails just the file name and the directory it's in. I can embelish other details later via ASP, just need the bulk of the work done easily.
I have some experience of database design but not huge amounts of programming, other than the ASP side of things so if anyone has a complex answer please go gently with me!!!
Al
hello all and thanks in advance
here it what im trying to do
i have a client form to input client info
i want to take the address field and create a directory on a specified drive when i click a add record button and store that path in the table so i can call up files that will be scanned later.
been looking all over need help
B
Hello creators,
I have a little problem and it is creating and checking directories.
In my database I have a form, on it you can see a record of a project. This project has a keyfield called projectno.
On this form there is a button to create a directory with the projectnumber. So far so good. (code example: MkDir ("C:projects444323")
My problem:
If the directory for some reason already exist the code stops and gives an error.
Now I want to create some code that checks if the directory already excist so than I can skip making the directory.
Thanks for the help!!!!!
hello good day. hope im inthe right place.
can someone point out to me if there is a way to do a file upload using ms access 2003 and not just stor the file path...thanks
i am new to access. how to create a list of files in a directory outside of the access program C:UsersalDesktopMSACCESS PROGRAM is the location
View 2 Replies View Relatedcreating a searching form and to show the results inside the form! It's like a Library type searching. u want to search for some type of monument or so and it shows the results, all the info, photos and that!
View 6 Replies View RelatedI have three objects a Main_Table , ClientDataForm and a MapForm all three share a common ClientID number
From that Main_Table I have created a ClientDataForm form which I enter all Data
From ClientDataForm I wish to create a button on it which runs a Macro that Saves ClientDataForm Record and then populates another form named MapForm with whatever record is currently open in Form One whether a newly created one or previous record.
How would I write this code for that button? Also why I would write it that way?