Dear friends & (Arthur Wood),

I tried to do the following code mentioned from my first question. I think
I am doing something wrong here.

thanks in advance for all you great help!

Brad Isaacs
Junior VB Developer

My code is below, please see:

I have (SQL = SQL &) because I have another SQL Statement that performs work
for date To and From through my DTPickers. I am just concatenating the SQL
Statements.

If cboStudyID.Text <> "<All Studies>" Then

Dim strStudyIDText As String
Dim lStudyID As Long
Dim iPosition As Integer

strStudyIDText = cboStudyID.Text
iPosition = InStr(" ", strStudyIDText)

If iPosition > 0 Then
lStudyID = CLng(Left$(strStudyIDText, iPosition - 1))
End If


'In SQL, compare cboStudyID with 3 fields (AuditTrailTableKey,
'AuditTrailFrom and AuditTrailTo) found within Audit Trail Table.
SQL = SQL & " and (AuditTrailTableKey = '" & lStudyID & "')" & _
" Or (AuditTrailFrom = '" & lStudyID & "') Or (AuditTrailTo =
'" & lStudyID & "')"
MsgBox SQL

'SQL = SQL & " and (AuditTrailTableKey = '" & cboStudyID.Text
& "')" & _
'" Or (AuditTrailFrom = '" & cboStudyID.Text & "') Or (AuditTrailTo
= '" & cboStudyID.Text & "')"
'MsgBox SQL
'Display on the report, the StudyID that the user chose
m_Report.SubTitle.SetText " Audit Trail - StudyID: " & cboStudyID.Text
End If