newtovba said:
That's great thanks. However. How do I connect to one database or the other?
Cheers
Well theres lots of different ways you could do this through your GUI
You could do it automatically by having the code look for a default when you open the db. If the default isn't there then an IF routine will link to the alternative.
You could do it semi-automatic by placing one or more buttons on a form and have that form open as soon as you open the db.
You could have a button that opens up a list box so you can pick from a list.
you could activate an unbound text control and ask the user for the information. If you do this then you will need to pass this information as a string to your code.
And there are many others.
Personally, if possible, I would choose the first option. To do this you could use an auto-exec routine when the db first opens to fire your code. Your code would then need to deal with the links to both db's and read one as a default.An If routine would switch to the second choice if the default is not available.
I would then add an error routine that stops the process if something is wrong and ask the user for information.
This method would be ok if your db's are stattic. I.e. they never change location and the table structure dosn't change.
If your table structure changes then you will have problems for obvious reasons.
If the location changes then you will need to ask for a path every time you try to conect.