Query to get some values

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
clonemaster
Forum Newbie
Posts: 12
Joined: Sun Aug 02, 2009 1:10 pm

Query to get some values

Post by clonemaster »

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!

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)
Post Reply