Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter by field/column using a Form

Status
Not open for further replies.

dwight1

IS-IT--Management
Aug 22, 2005
176
US
I want to filter the field/column based on my selection in the form. Is this possible?

For example,

I have different months
Jan Feb March April
100 200 300 400
150 250 450 550


Now for reporting purposed i have to change the month in the code before the beginning of the month. Can i give an uility in the form to select the month and it changes it in the code that produces report.

Any help.

Dwight
 
Can you paste in the SQL code that you are modifying as a starting point.
 
Here is the code:

SELECT dbo.A_GLMastTbl.NETBAL AS DailyChange,
dbo.A_GLMastTbl.Aug AS MonthlyChange, dbo.A_GLMastTbl.CBAL AS CurBal
FROM dbo.A_GLMastTbl

In the above code Aug is the month that reflects, once sep is complete i want Sep in place of Aug.

I want to select the month from form.

Hope it helps.

Dwight
 
Are you building this SQL in the OnOpen event of the Form? Something like.

Dim mySQL as Variant, myMonth as integer
Dim mCode as String
myMonth = DatePart("m", Now())
Select Case myMonth
Case 1
mCode = "dbo.A_GLMastTbl.Jan"
Case 2
mCode = "dbo.A_GLMastTbl.Feb"
Case "HDN1 "
mCode = "dbo.A_GLMastTbl.Mar"
Case Else
Debug.Print "Default"
End Select


mySQL = "SELECT dbo.A_GLMastTbl.NETBAL AS DailyChange, " & _
mCode & " AS MonthlyChange, " & _
"dbo.A_GLMastTbl.CBAL AS CurBal " & _
"FROM dbo.A_GLMastTbl "

Me.RecordSource = mySQL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top