I have a form, in which you can select a variety of option of where to output the data. Option 1 is to a spreadsheet, 2 is to an access report, and 3 it just to open a datasheet view. This is all based off of a crosstab query using a querydef (temporary query that gets deleted at the end of the sub).
Everything works fine and just how I would like when using CurrentDB. However, I wanted to make this a little better and add in options for other Databases.
So, before was
And the new of what I would LIKE to do is the following. I can't seem to get it to work right. At best, it gives me an error saying there is no "Query". I thought this would work....
So, what I want is when a person has their database open, they click on this form and choose which Location option (and any other option on the form). Then, it would either send the spreadsheet, open a report, or open a datasheet.
Is this possible?
-Stoss
Everything works fine and just how I would like when using CurrentDB. However, I wanted to make this a little better and add in options for other Databases.
So, before was
Code:
Set dbs = CurrentDB
And the new of what I would LIKE to do is the following. I can't seem to get it to work right. At best, it gives me an error saying there is no "Query". I thought this would work....
Code:
Select Case Me.FrameLocation.Value
Case 1 'ORL
Set dbs = CurrentDb
strSelectedLocation = "ORL"
Case 2 'PKS
Set dbs = OpenDatabase("\\ps-s002\Maintenance\Database\PKS.mdb")
strSelectedLocation = "PKS"
Case 3 'SDL
Set dbs = OpenDatabase("C:\SDL\SDL.mdb")
strSelectedLocation = "SDL"
Case 4 'DFW
Set dbs = OpenDatabase("C:\DFW\DFW.mdb")
strSelectedLocation = "DFW"
End Select
Set qdf = dbs.CreateQueryDef(strQName, strSQL)
qdf.Close
So, what I want is when a person has their database open, they click on this form and choose which Location option (and any other option on the form). Then, it would either send the spreadsheet, open a report, or open a datasheet.
Is this possible?
-Stoss