How to select current month when no dates are involved?

andy_dyer

Registered User.
Local time
Today, 19:55
Joined
Jul 2, 2003
Messages
806
Hi,

I've got a new database that i am trying to get to work...

It's mainly centred around budgets and actuals...

I've got two tables tblBudget and tblActual

With twelve fields in each... Budget Month 1, Budget Month 2 etc and Actual Month 1, Actual Month 2 etc

I've managed to link these together and begin to play some tunes on variance etc and calculate cummulative numbers etc

BUT

I'm being asked to show "current month" budget vs actual and "year to date" budget vs actual and then calculate the end of year forecast based on current actuals and remaining budget...

My major problem is how to get the current month selecetd...

I was figuring that if I created a form with combo boxes where I could pick Budget Month 2 and Actual Month 2 I could somehow within my query look those up as the current month...

Does that make sense?

How can I pick one field out using a combo box selection?

i.e. if i pick Budget Month 2 can i get the query to only return the number for that month from the entire record?
 
In my opinion the fact that your data is not normalized will make this more difficult. The only option I see offhand is to build your SQL in code, since the field(s) in the SELECT clause will vary based on the user selection. Along the lines of:

strSQL = "SELECT " & ComboBoxWithFieldSelection " FROM TableName..."

'do something with strSQL
 

Users who are viewing this thread

Back
Top Bottom