G
Guest
Hi! Thank you for your kind attention and i would appreciate the advices you
give!
Query B that draws its fields from Table A & Query A. The Query B has 2
criteria of the type [Please enter ... below:]. A Report displays the fields
in Query B.
Ultimately, I would like to insert a page break (called NewDay) in the
Report when the "Day" field in Query B changes its value. So I thought I
should put Query B in a recordset, then loop thru the "Day" field of each
record and detect changes. Now, I got a object type mismatch error when i run
the following code.
Dim MyDB As DAO.Database
Dim MyRecordSet As DAO.Recordset
Dim qdf As QueryDef
Dim prm As Parameter
Dim intA As Integer
Dim intB As Integer
Set MyDB = CurrentDb
Set qdf = MyDB.QueryDefs("Q- Rep Planner")
Set MyRecordSet = qdf.OpenRecordset("Q- Rep Planner")
MyRecordSet.MoveFirst
Do Until MyRecordSet.PercentPosition = 100
intA = MyRecordSet![Day]
MyRecordSet.MoveNext
intB = MyRecordSet![Day] - intA
If intA >= 1 And intB = 1 Then
Me![NewDay].Visible = True
Else
Me![NewDay].Visible = False
End If
Loop
Set MyDB = Nothing
Set qdf = Nothing
Set MyRecordSet = Nothing
give!
Query B that draws its fields from Table A & Query A. The Query B has 2
criteria of the type [Please enter ... below:]. A Report displays the fields
in Query B.
Ultimately, I would like to insert a page break (called NewDay) in the
Report when the "Day" field in Query B changes its value. So I thought I
should put Query B in a recordset, then loop thru the "Day" field of each
record and detect changes. Now, I got a object type mismatch error when i run
the following code.
Dim MyDB As DAO.Database
Dim MyRecordSet As DAO.Recordset
Dim qdf As QueryDef
Dim prm As Parameter
Dim intA As Integer
Dim intB As Integer
Set MyDB = CurrentDb
Set qdf = MyDB.QueryDefs("Q- Rep Planner")
Set MyRecordSet = qdf.OpenRecordset("Q- Rep Planner")
MyRecordSet.MoveFirst
Do Until MyRecordSet.PercentPosition = 100
intA = MyRecordSet![Day]
MyRecordSet.MoveNext
intB = MyRecordSet![Day] - intA
If intA >= 1 And intB = 1 Then
Me![NewDay].Visible = True
Else
Me![NewDay].Visible = False
End If
Loop
Set MyDB = Nothing
Set qdf = Nothing
Set MyRecordSet = Nothing