Hi all!! Long time since i've posted on bit-tech, have turned into a lurker! I'm having a head ache with a database i'm makeing for work, and am now stumped and was hoping someone out there would be able to help. My Visual Basic is... well... basic! I have a the database stored on a networked drive, and i need the users to be able to find a file, ideally using the standard windows open dialog box, (but not actually open it, just find store the file location to use) then rename it, save it to a standard location on the network drive and log it in a table on the database. I've found the below link to the OpenFile function and have tried it, but really can't get it to work... http://access.mvps.org/access/api/api0001.htm Can anyone help me pleeeease treating me as an idiot!?!?!?!?! Thanks!!!
why do they need to rename it and store it on the server, you could write a script to do that a lot easier?
That's ideally what i'd want the code to do, re-name the file after ID field in the open DB record and save it in a central location... i've got odds and ends, but can't patch anything together
First what you need to do is open your connection to your table call the file dialogue function and store the outputs of that to your table. Code: Dim db as databse dim rs as database dim sfile as string, spath as string set db = currentdb set rs = db.openrecordset("select * from [yourtable]") With Application.FileDialog(msoFileDialogOpen) .AllowMultiSelect = false .InitialFileName = "\\default\location .Filter 'if appropriate .Show sFile = .SelectedItems(1) 'might be 0 sPath = .SelectedItems(1).path 'might have made that up end with 'feed file and path to your table. rs("File") = sFile rs.update end function I can't think how to do the copy off the top of my head, but the code above isn't tested so someone will have a solution (hopefully) by the time you get that coded up properly.
Can't recall if it's fixed or not.. but I think there was a vb bug for "save as".. so careful with that one.