This Code is giving me an error message (Error #91 - Object variable or With block variable not set). I can't find where I have not defined a variable. Can anyone else see offhand what is causing my problem? All the fields that I draw information from are not null but I don't know what is causing my problem.
Dim rst As DAO.Recordset
Dim db as DAO.Database
Dim StCode As String
Dim Medium As String
Dim AlbumNum As Long
Dim Sig As String
Medium = Me.cboMedium
StCode = Me.cboType & " "
Select Case Medium
Case Is = "Cassette"
Medium = "C"
Case Is = "Compact Disc"
Medium = "D"
Case Is = "Album"
Medium = "A"
End Select
AlbumNum = 0
strSQL = "SELECT * FROM tblArtists WHERE ArtistRef = " & Me.cboArtist.Column(0)
Set rst = db.OpenRecordset(strSQL) ' - (Error #91 - Object variable or With block variable not set)
Sig = rst!Signature
StCode = Me.cboType & " " & Sig & "." & AlbumNum & Medium
strSQL = "SELECT * FROM tblAlbums WHERE NewStationCode = '" & StCode & "'"
Set rst = db.OpenRecordset(strSQL)
Do While rst.RecordCount > 0
AlbumNum = AlbumNum + 1
StCode = Me.cboType & " " & Sig & "." & AlbumNum & Medium
strSQL = "SELECT * FROM tblAlbums WHERE NewStationCode = '" & StCode & "'"
Set rst = db.OpenRecordset(strSQL)
Loop
Me.txtCodeNew = UCase(StCode)
Thanks, Caleb
Dim rst As DAO.Recordset
Dim db as DAO.Database
Dim StCode As String
Dim Medium As String
Dim AlbumNum As Long
Dim Sig As String
Medium = Me.cboMedium
StCode = Me.cboType & " "
Select Case Medium
Case Is = "Cassette"
Medium = "C"
Case Is = "Compact Disc"
Medium = "D"
Case Is = "Album"
Medium = "A"
End Select
AlbumNum = 0
strSQL = "SELECT * FROM tblArtists WHERE ArtistRef = " & Me.cboArtist.Column(0)
Set rst = db.OpenRecordset(strSQL) ' - (Error #91 - Object variable or With block variable not set)
Sig = rst!Signature
StCode = Me.cboType & " " & Sig & "." & AlbumNum & Medium
strSQL = "SELECT * FROM tblAlbums WHERE NewStationCode = '" & StCode & "'"
Set rst = db.OpenRecordset(strSQL)
Do While rst.RecordCount > 0
AlbumNum = AlbumNum + 1
StCode = Me.cboType & " " & Sig & "." & AlbumNum & Medium
strSQL = "SELECT * FROM tblAlbums WHERE NewStationCode = '" & StCode & "'"
Set rst = db.OpenRecordset(strSQL)
Loop
Me.txtCodeNew = UCase(StCode)
Thanks, Caleb