boborsipho
Programmer
I've been trying to get this to work for days now. My code is below. I'm not really familiar with VB.
The first error was the "Too few parameters, expected 1".
I changed my code a bit and now it's "Object 'Times' already exists".
What am I doing wrong and how do I fix it. Is it necessary for the QueryDef & Recordset?
Thanx Bob
Dim rs As Recordset
Dim db As Database
Dim qdf As QueryDef
Dim temp As String
temp = "Date" & mynum & ""
//mynum is a parameter of the function
sql = "SELECT [Entertainment]![Name] & [Entertainment]![FirstName] & ' ' & [Entertainment]![Surname] AS TheName, EventCalendar.Date, EventCalendar.Time, EventCalendar.Highlighted FROM Entertainment, EventCalendar WHERE Entertainment.UniqueEntertainmentNumber=EventCalendar.UniqueEntertainmentNumber AND EventCalendar.Date=" & "[Forms]![frmCalender]!#[" & temp & "]#;"
Set qdf = db.CreateQueryDef("Times", sql)
Set rs = qdf.OpenRecordset(dbOpenDynaset)
The first error was the "Too few parameters, expected 1".
I changed my code a bit and now it's "Object 'Times' already exists".
What am I doing wrong and how do I fix it. Is it necessary for the QueryDef & Recordset?
Thanx Bob
Dim rs As Recordset
Dim db As Database
Dim qdf As QueryDef
Dim temp As String
temp = "Date" & mynum & ""
//mynum is a parameter of the function
sql = "SELECT [Entertainment]![Name] & [Entertainment]![FirstName] & ' ' & [Entertainment]![Surname] AS TheName, EventCalendar.Date, EventCalendar.Time, EventCalendar.Highlighted FROM Entertainment, EventCalendar WHERE Entertainment.UniqueEntertainmentNumber=EventCalendar.UniqueEntertainmentNumber AND EventCalendar.Date=" & "[Forms]![frmCalender]!#[" & temp & "]#;"
Set qdf = db.CreateQueryDef("Times", sql)
Set rs = qdf.OpenRecordset(dbOpenDynaset)