Hello All,
I have a table. I query the table using VBA embedded SQL. i store the resultant query in a query.
If I run my query, my results follow the form:
Item: Date:
Black Shoes 10/07/2004
Black Shoes 10/21/2004
Black Shoes 10/28/2004
Red Shoes 10/07/2004
Brown Shoes 10/21/2004
Now, I want to write a report which puts an X if there is an entry for that date.
ie.
________________________________________________________
Product Report: Shoes
Item: 10/07/2004 10/14/2004 10/21/2004 10/28/2004 11/05/2004
Black Shoes X X X
Brown Shoes X
Red Shoes X
---------------------------------------------------------
I thought I was close to having the report complete as it all works, except each Item creates a new row as it exists in the db. ie. Currently my report looks like:
________________________________________________________
Product Report: Shoes
Item: 10/07/2004 10/14/2004 10/21/2004 10/28/2004 11/05/2004
Black Shoes X
Black Shoes X
Black Shoes X
Brown Shoes X
Red Shoes X
---------------------------------------------------------
I have tried to use the 'MoveLayout = False' action/method/thing which works great if there is only one type of item in the db. But overwrites everything if there are multiple items.
So I tried to write some code to check for the condition that if the item was the same, then MoveLayout - False otherwise MoveLayout = True.
Sounds simple enough, but I can't get the condition to evaluate correctly:
Here is my code:
Essentially I opened the query as a recordset, as a recordset allows you to compare specific field values.
But the code does'nt work, it seems to be called for every record that is displayed, and does not enter the loop?
If anyone can help/offer alternate suggestions on how to do this, it is greatly appreciated.
Thanks - blakey2.
I have a table. I query the table using VBA embedded SQL. i store the resultant query in a query.
If I run my query, my results follow the form:
Item: Date:
Black Shoes 10/07/2004
Black Shoes 10/21/2004
Black Shoes 10/28/2004
Red Shoes 10/07/2004
Brown Shoes 10/21/2004
Now, I want to write a report which puts an X if there is an entry for that date.
ie.
________________________________________________________
Product Report: Shoes
Item: 10/07/2004 10/14/2004 10/21/2004 10/28/2004 11/05/2004
Black Shoes X X X
Brown Shoes X
Red Shoes X
---------------------------------------------------------
I thought I was close to having the report complete as it all works, except each Item creates a new row as it exists in the db. ie. Currently my report looks like:
________________________________________________________
Product Report: Shoes
Item: 10/07/2004 10/14/2004 10/21/2004 10/28/2004 11/05/2004
Black Shoes X
Black Shoes X
Black Shoes X
Brown Shoes X
Red Shoes X
---------------------------------------------------------
I have tried to use the 'MoveLayout = False' action/method/thing which works great if there is only one type of item in the db. But overwrites everything if there are multiple items.
So I tried to write some code to check for the condition that if the item was the same, then MoveLayout - False otherwise MoveLayout = True.
Sounds simple enough, but I can't get the condition to evaluate correctly:
Here is my code:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim currValue
Set db = CurrentDb
Set rs = db.OpenRecordset("qryShoes")
'rs.MoveFirst
' Intialise the current Value
currValue = rs![cs.storecode]
Do While Not rs.EOF And rs.BOF
If rs![cs.storecode] = currValue Then
Me.MoveLayout = False
Else
Me.MoveLayout = True
End If
rs.MoveNext
currValue = rs![cs.storecode]
Loop
End Sub
Essentially I opened the query as a recordset, as a recordset allows you to compare specific field values.
But the code does'nt work, it seems to be called for every record that is displayed, and does not enter the loop?
If anyone can help/offer alternate suggestions on how to do this, it is greatly appreciated.
Thanks - blakey2.