Search String in VBA Code

  • Thread starter jrbph via AccessMonster.com
  • Start date
J

jrbph via AccessMonster.com

Hi to everyone,

Need your help!!!

I have Main Form with Subform on it. I have successfully retrieve record
using this code

Dim dbs As DAO.Database, qdf As DAO.QueryDef, rst As DAO.Recordset, strSQL As
String

On Error GoTo Err_writeRecord

strSQL = "SELECT * FROM TblMainTable WHERE BookDesc like '" & varTitle & "';"


Set dbs = CurrentDb()
Set qdf = dbs.CreateQueryDef("", strSQL)
Set rst = qdf.OpenRecordset()
With rst
If .RecordCount > 0 Then
DoCmd.ApplyFilter strSQL
Else
MsgBox "No record found, try to refine or rephrase your search...",
vbExclamation, "SalitaNiya-KJV Query System Alert!!!"
Me.Title.SetFocus
End If
End With
Set rst = Nothing
Set qdf = Nothing
Set dbs = Nothing

Exit_writeRecord:
Exit Sub

Err_writeRecord:
MsgBox Err.Description, vbExclamation, "SalitaNiya-KJV Query System Alert!
!!"
Resume Exit_writeRecord

End Sub

Here's my PROBLEM:

I want to add 2 more fields in the StrSQL variable as where clauses. How
could I combined another clauses with the next 2 more fields on the same
concatenated string?

Thanks... hope to hear from you...

Rody
 
E

eos

AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top