R
Renee
Good morning all,
I am having trouble with string vs numeric in a multiple DLookup and
using multiple lines. Here is the code I am trying to finess (I only changed
variable names to music topics, to help me represent my problem). I know the
ampersands are missing if this were written in one line, but am unable to get
this to work. Honestly, I am not even sure if DLookup can use 3 criteria.
Dim stDocName As String
Dim varID As Variant
varID = DLookup("[RecordID]", "tbl_Songs", "[txtArtist]= '" & Me.Artist
& "'" & _
"And [AlbumNum]= " &
Me.AlbumNum & _
" And [txtTrackID] =
'" & Me.TrackID"'")
stDocName = "SongRvw"
If Not IsNull(varID) Then
DoCmd.OpenReport stDocName, acViewPreview, , "[tbl_Songs].[RecordID]
= " & varID
Else
MsgBox "No Record Found.", vbOKOnly
cancel = True
End If
Thank you,
Renee
I am having trouble with string vs numeric in a multiple DLookup and
using multiple lines. Here is the code I am trying to finess (I only changed
variable names to music topics, to help me represent my problem). I know the
ampersands are missing if this were written in one line, but am unable to get
this to work. Honestly, I am not even sure if DLookup can use 3 criteria.
Dim stDocName As String
Dim varID As Variant
varID = DLookup("[RecordID]", "tbl_Songs", "[txtArtist]= '" & Me.Artist
& "'" & _
"And [AlbumNum]= " &
Me.AlbumNum & _
" And [txtTrackID] =
'" & Me.TrackID"'")
stDocName = "SongRvw"
If Not IsNull(varID) Then
DoCmd.OpenReport stDocName, acViewPreview, , "[tbl_Songs].[RecordID]
= " & varID
Else
MsgBox "No Record Found.", vbOKOnly
cancel = True
End If
Thank you,
Renee