R
Richard Hollenbeck
I can't figure out what is wrong. I commented out the WHERE clause and now
it works, though it shows all records because the WHERE clause is missing.
When I un-comment (') the WHERE clause I get a type mismatch. groupID is a
long integer and the listbox data is obviously a string. but when I tried
CLng([activities].[groupID]= etc... ) nothing was different. I still got
the same mismatch error.
Here's the code that still works, including my disabled WHERE clause:
Private Sub PopulateActivityList()
Dim dbActivities As DAO.Database, rsActivities As DAO.Recordset, StrSQL
As String
StrSQL = "SELECT [activities].[activityID] as [ID],
[activities].[activityDescription] AS [Activity],
[activities].[targetActivityWeight] AS [Weight] FROM [activities];" ' WHERE
[activities].[groupID] = '" & Me!groupID & "';"
Set dbActivities = CurrentDb()
Set rsActivities = dbActivities.OpenRecordset(StrSQL, dbOpenDynaset)
Set lstActivities.Recordset = rsActivities
Thanks,
Rich Hollenbeck
it works, though it shows all records because the WHERE clause is missing.
When I un-comment (') the WHERE clause I get a type mismatch. groupID is a
long integer and the listbox data is obviously a string. but when I tried
CLng([activities].[groupID]= etc... ) nothing was different. I still got
the same mismatch error.
Here's the code that still works, including my disabled WHERE clause:
Private Sub PopulateActivityList()
Dim dbActivities As DAO.Database, rsActivities As DAO.Recordset, StrSQL
As String
StrSQL = "SELECT [activities].[activityID] as [ID],
[activities].[activityDescription] AS [Activity],
[activities].[targetActivityWeight] AS [Weight] FROM [activities];" ' WHERE
[activities].[groupID] = '" & Me!groupID & "';"
Set dbActivities = CurrentDb()
Set rsActivities = dbActivities.OpenRecordset(StrSQL, dbOpenDynaset)
Set lstActivities.Recordset = rsActivities
Thanks,
Rich Hollenbeck