I've got a Access form and i'm trying to write code to return a set of records based on an SQL query. The below code only returns 1 record. Anyone know how I can return multiple records? Thanks!
Dim db As Database
Dim rs As Recordset
Dim strSql As String
Dim TICKET_NUMBER As Long
strSql = "SELECT * "
strSql = strSql & "FROM [Service_Calls] "
strSql = strSql & "WHERE [ticket_no] = '"
strSql = strSql & TICKET_NO & "';"
Set db = CurrentDb() ' Open pointer to current database
Set rs = db.OpenRecordset(strSql) ' Create recordset based on SQL
If rs.RecordCount = 0 Then
MsgBox "There is no appointment for ticket number " & TICKET_NO & "."
Exit Sub
End If
Dim db As Database
Dim rs As Recordset
Dim strSql As String
Dim TICKET_NUMBER As Long
strSql = "SELECT * "
strSql = strSql & "FROM [Service_Calls] "
strSql = strSql & "WHERE [ticket_no] = '"
strSql = strSql & TICKET_NO & "';"
Set db = CurrentDb() ' Open pointer to current database
Set rs = db.OpenRecordset(strSql) ' Create recordset based on SQL
If rs.RecordCount = 0 Then
MsgBox "There is no appointment for ticket number " & TICKET_NO & "."
Exit Sub
End If