Query to get some values
Posted: Sun Mar 20, 2011 2:00 pm
Not sure if this is teh correct place, but I'm getting desperate. so sorry if it's not.
I have a Query in Access which gives good results.
I'm trying to use this query in the On Open event of a form, but I can't get it to do what I want.Tried several things, googled etc.
Hope someone can help me out..
This is the VBA code now:
Thanks in advance!
I have a Query in Access which gives good results.
I'm trying to use this query in the On Open event of a form, but I can't get it to do what I want.Tried several things, googled etc.
Hope someone can help me out..
This is the VBA code now:
Thanks in advance!
Code: Select all
Private Sub Report_Load()
Dim StrSQL As String
StrSQL = "SELECT DISTINCT registratie.periode, " & _
"periode.Periode_startdatum, periode.Periode_einddatum " & _
"FROM periode INNER JOIN registratie ON periode.Periode_naam = registratie.periode " & _
"WHERE (((registratie.periode)=[Rapporten]![Rpt_Tot_Project_uren]![periode]))"
DoCmd.RunSQL StrSQL
Me!Pstartdatum = Periode_startdatum
Me!Peinddatum = Perode_einddatum
Me!eindweek = DatePart("ww", [Periode_einddatum], 2, 2)
Me!Week = DatePart("ww", [Periode_startdatum], 2, 2)