I'm using VB6 as my frontend and MSACCESS as backend.

I have a field in tblHistory named "payperiod". I have put text in this field.

content of payperiod: JANUARY 1 - 15, 2006
JANUARY 16 - 31, 2006
FEBRUARY 1 - 15, 2006
FEBRUARY 16 - 28, 2006 and so on.

i have a SSTAB1 with 12 Tabs. each tab has a datagrid. Tab1.Caption = "January", Tab2.Caption = "February" Tab3.Caption = "March", until Tab12 = "December".

Now i want to get the report using Crystal Report for month based on SSTAB1.CAPTION.

here is my code: this will filter only the Month

Private Sub SSTab1_Click(PreviousTab As Integer)
AdoHistory.CommandType = adCmdText
AdoHistory.RecordSource = "select * from tblHistory where payperiod like '" & SSTab1.Caption & "%'"
AdoHistory.Refresh

End Sub

thanks in advance...

if crpt is the control name used in the form then

Code is:
CRPT.selectionformulae = "payperiod like '" & SSTab1.Caption & "%'"

Try it once

If you want to send the month name as parameter to crystal report to display then create one formulaefield in cruystalreport

and from vbcode

crpt.formulaes(0) = "<FORMULAENAME in CRYSTAl REPORT> = '" & SSTAB1.CAPTION & "'"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.