I am trying to read a few columns from a SQL table into a MSAccess Project report. I only need a simple recordsource select statement for the report's recordsource, but I need a where criteria that is an integer on a form in the project that is always open. However, I cannot get the syntax right for the where clause in my SQL recordsource select statement. I am trying:
SELECT comments_id, participant_id, comment_type_cd, comments, created_by_userid, created_ts
FROM dbo.XX_COMMENTS
WHERE participant_id = Forms ! frmXXX_YYY_MainData ! [txtParticipantID]
ORDER BY comments_id DESC
but I keep getting the error that the ! character is not valid. Anyone know what the syntax would be for my where clause to reference a field on my form as a criteria? Thanks for any help you cn offer.
SELECT comments_id, participant_id, comment_type_cd, comments, created_by_userid, created_ts
FROM dbo.XX_COMMENTS
WHERE participant_id = Forms ! frmXXX_YYY_MainData ! [txtParticipantID]
ORDER BY comments_id DESC
but I keep getting the error that the ! character is not valid. Anyone know what the syntax would be for my where clause to reference a field on my form as a criteria? Thanks for any help you cn offer.