G
Guest
Hello all,
I have an unbound form with a list box. I only want this form to open at
startup if there will be data in the list box. So.... I figured I would run
the same SQL or ADO or DAO, and if any record(s) are found, open the form...
Here is the rowsource of the List box. Can someone help me with how I can
check for data in this SQL?
SELECT *
FROM qry_Reminders_Open
WHERE
(((qry_Reminders_Open.Reminder_Owner)=Eval("[Forms]![Opening].[EmployeeNum].Column(4)")) AND ((qry_Reminders_Open.Reminder_Status)="Open"))
ORDER BY qry_Reminders_Open.Date;
I have tried this, but get an error that it is not a valid SQL statement...
Dim sql As String
sql = "SELECT * " & _
"FROM qry_Reminders_Open " & _
"where (((qry_Reminders_Open.Reminder_Owner) =
Eval('[Forms]![Opening].[EmployeeNum].Column(4)')) And
((qry_Reminders_Open.Reminder_Status) = 'Open'));"
DoCmd.RunSQL sql
If IsNull(sql) Then
MsgBox "NULL"
Else
MsgBox "NOT NULL"
End If
Thank you in advance for your assistance.
I have an unbound form with a list box. I only want this form to open at
startup if there will be data in the list box. So.... I figured I would run
the same SQL or ADO or DAO, and if any record(s) are found, open the form...
Here is the rowsource of the List box. Can someone help me with how I can
check for data in this SQL?
SELECT *
FROM qry_Reminders_Open
WHERE
(((qry_Reminders_Open.Reminder_Owner)=Eval("[Forms]![Opening].[EmployeeNum].Column(4)")) AND ((qry_Reminders_Open.Reminder_Status)="Open"))
ORDER BY qry_Reminders_Open.Date;
I have tried this, but get an error that it is not a valid SQL statement...
Dim sql As String
sql = "SELECT * " & _
"FROM qry_Reminders_Open " & _
"where (((qry_Reminders_Open.Reminder_Owner) =
Eval('[Forms]![Opening].[EmployeeNum].Column(4)')) And
((qry_Reminders_Open.Reminder_Status) = 'Open'));"
DoCmd.RunSQL sql
If IsNull(sql) Then
MsgBox "NULL"
Else
MsgBox "NOT NULL"
End If
Thank you in advance for your assistance.