I guess this can't be the right way to do this as I just get an hourglass and a "ghost" of a form until I hit Cntrl-Pause. Then the Form shows,
What i want to do is, close the Form with the mouse and have it move to the next set of data to show... and so on.
I'd be very keen to learn where I've gone wrong. Here's my code. The Form was made with the wizard with its source 'zqryShow". I may not need this query
and could set the Forms source directly the sql. I was going to try that later.
Sub ShowData()
Dim myQuery As QueryDef
Dim r As DAO.Recordset
Dim S As String
Set r = CurrentDb.OpenRecordset("qryNewSingles")
r.MoveFirst
Do
If Nz(r!Done) = "" Then 'This record has not been alrtady shown
'get all entries with matching AT
S = "Select TheDate, WeeksOn, LastWeek, ThisWeek, Artist, Title, Label, Number from qryNewSingles Where Artist = 'AAA' and Title = 'TTT' Order By TheDate;"
S = Replace(S, "'", Chr$(34))
S = Replace(S, "AAA", r!Artist)
S = Replace(S, "TTT", r!Title)
Set myQuery = CurrentDb.QueryDefs("zqryShow")
myQuery.SQL = S
DoCmd.OpenForm "frmShow", acFormDS, , , , acDialog
'TODO Set Done flag
End If
r.MoveNext
Loop Until r.EOF
End Sub
What i want to do is, close the Form with the mouse and have it move to the next set of data to show... and so on.
I'd be very keen to learn where I've gone wrong. Here's my code. The Form was made with the wizard with its source 'zqryShow". I may not need this query
and could set the Forms source directly the sql. I was going to try that later.
Sub ShowData()
Dim myQuery As QueryDef
Dim r As DAO.Recordset
Dim S As String
Set r = CurrentDb.OpenRecordset("qryNewSingles")
r.MoveFirst
Do
If Nz(r!Done) = "" Then 'This record has not been alrtady shown
'get all entries with matching AT
S = "Select TheDate, WeeksOn, LastWeek, ThisWeek, Artist, Title, Label, Number from qryNewSingles Where Artist = 'AAA' and Title = 'TTT' Order By TheDate;"
S = Replace(S, "'", Chr$(34))
S = Replace(S, "AAA", r!Artist)
S = Replace(S, "TTT", r!Title)
Set myQuery = CurrentDb.QueryDefs("zqryShow")
myQuery.SQL = S
DoCmd.OpenForm "frmShow", acFormDS, , , , acDialog
'TODO Set Done flag
End If
r.MoveNext
Loop Until r.EOF
End Sub