Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Existence, Raison D'etra and Common Dialog Boxes

Status
Not open for further replies.

LegoPiece

Programmer
Mar 19, 2001
95
0
0
US
Hi Everybody!

I really hope you guys can help me out with this seemingly paltry dilemma I've encountered. I'm using ADOX to create a new Access Database - this works just fine. I use the Common Dialog box (show open) to allow the user to select a location (drive + folder), and type in a name for the new file to be created. When the user clicks OK - the file gets created (using my "CreateNewDatabase" function), and my application links to that file. This works just fine.

HOWEVER - When a pre-existing .mdb file is selected in the Common Dialog box - I'm screwed, because my function "CreateNewDatabase(FileName as String)" gets called after exiting the Common Dialog box, causing problems (Database Already Exists).

Now, is there a way I can check to see if the file (whether typed or selected in the Common Dialog box) already exists - so that I can provide the user with the option to either a) Overwrite the exiting file b) Simply link to that File or c) Cancel outa there?

I hope this makes sense! If not, please let me know so I can further clarify the details of this tragic affair.

Thanks!
LeGo PiEcE

"The Computer Spock! Destroy it!" - Captain James T. Kirk
 
FileSystemObject has a FileExist method that would work.
 
Hey Tom!

That was a DOPE solution - you ARE the man! I kept thinking that I'd have to do some 'narly Win32 API stuff with file handles and such! But thank you thank you thank you! Not only did this sort my problem out - it's opened a whole new door for me with file operations!

Anyway, consider yourself one beer richer, whenever you're in California! Now you will excuse me, I hope... I have some sinister experimenting to do ... =)

Thanks!
LeGo PiEcE

"The Computer Spock! Destroy it!" - Captain James T. Kirk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top