Newbie needs help with 'add file path' button please!

Kernowgreen

New member
Local time
Today, 04:31
Joined
Feb 17, 2011
Messages
2
Hi, first post so please be gentle! (Hope this is in the right place too...)

I have a db where I need to store a file path in a table, so have a form with a button to open a browser to select the path which is then put into a field - the code for this came from a Microsoft page and uses a common api.

This seems to work fine as far as it goes, but I have a problem that once a file path has already been entered if a user was to click the 'browse' button again and then either close it or cancel out of it without selecting a file path it will delete the path which had previously been stored.

Is there a way to code the button so that if the field containing the file path already has data, that pressing the cancel or close buttons will leave that data intact rather than clearing the field?

I suppose another way would be to lock the 'browse' button once data was already in the field, but that would mean that the path could not be changed if needed, so I'd rather have some way to leave existing data intact instead.

I have attached a sample with the code that I am currently using in the hope that someone can help me with this please.

Many thanks
 

Attachments

I can't look at your db now
if you put your browse button on a form that will only allow new records (set the form's property to .DataEntry (don't forget to set .AllowAddition to True) all you have to do is use the me.Refresh code to save the record and be ready for new browse
 
Thanks for your quick reply - I think that this may be what I have to do to get around the issue, although I think that for my purposes it will mean calling a sub-form with the properties as you suggest to enter the data.
 

Users who are viewing this thread

Back
Top Bottom