Help populating data on Subform.

M

MBison80

Hi,
can anyone asist me in this problem.
I'm using AccessXP, I have a form that has a subform. The main form ha
a cboBox with the names of months as the value. The

subform has the data I would like refreshed. When the main form open
the subform displays records for the current day, this

works fine but I want to give the user the option to display data for
specific month.I have a query that takes the value of

the cboBox and shows the data I would like to see. I have also take
this query in SQL and tested it for the subforms

datasource, works fine. However trying to code the view for month i
proving difficult, can anyone pelase help ? Here is
the code I have so far...

Private Sub cboMonth_AfterUpdate()

Dim strMonth As Variant
Dim strSQL As String


strsql = "SELECT tblCalendar.MainProj, tblCalendar.Project
tblCalendar.Issue, tblCalendar.DueDate FROM tblCalendar " & _
strsql = strsql & "WHERE (((tblCalendar.DueDate) Betwee
Me.cboMonth.Value & "/01/04" " & _
strsql = strsql & "And Me.cboMonth.Value & "/" & me.txtmonth.value
"/04")) " & _
strsql = strsql & "ORDER BY tblCalendar.DueDate;"

Forms!tstcal.tstcalendar.Form!RecordSource = "strsql"

End Su
 
E

Ed Robichaud

Your approach might work (haven't tried testing it), but a better method may
be to use the DatePart() function to filter on the current year, then on the
form's cmbBox value.
-Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top