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
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