I have some exelfiles with data from different projects.
These are joined togheter in a query.
On my forms i have combo-boxes where u should be able to select a start-week and a stop-week that is used in other queries.
The interval for startweek and stopweek are calulated by selecting min(week) and max(week) from the joined exelfiles.
The problem is that this takes quite some time.
How can I store these values so that I don't have to run a query on joined tables every time a user clicks on a combobox?
I was thinkin of updating a table with the min(week) and max(week) of every project on startup using ADO or DAO, but don't know exactly how to do it. Anyway i'm not sure this is the right approach.
These will remain until one of two things happen, theres an error or you shut the database.
I usually create a module and call it globals. You can call it what you like !!
Then I simply add key words that I'll remember like:
Global Sqlstr as string
Global First_Date as Date
and so on. Just like Dim, but use global instead.
This means if I have a form open or module running, I can assign a value to Sqlstr and it will remain there even if the form/module is closed. If I open a new form and call this value Sqlstr the value will still be there. Great way f passing strings from Forms to Reports!
But like I say I have had problems where error 'blank' this value.
In your code, you could have public Your_Variable as String at the top of your code somewhere, this is almost the same as globals..
Bit of code I'm working on now !
Option Compare Database
Public Firstdate As Date
Private Sub Command_get_reg_data()
Dim Chk as integer
Chk = 0
For A = 1 To Me.Current_List.ListCount - 1
See where its placed.
Thanks fofr the help Ken, but I don't think this is what I'm looking for. I have about 10 projects, and the list will get longer with time. Creating a startweek and stopweek variable would then require at least 20 queries.
It would be better if I could just perform one query and then save the data I need in a table or something.