strCriteria declaration


G

Guest

I have problem writing the strCriteria declaration, the following is my code.
I guess my strCriteria declaration is incorrect, any help will be appreciated


Private Sub Form_Load()
Const strTableQueryName-“test_qryâ€
Dim db As DAO.Database,rst As DAO.Recordset
Set db=CurrentDb
Set rst = db.OpenReordset(strTableQueryName, dbOpenDyneaset, dbReadOnly)
TestFunction rst:=rst, strBooleanField:=â€uplinkâ€
End Sub

Sub TestFunction(rst As Recordset, strBooleanField As String)
……
…….
If srt.(strBooleanField) = false Then
strCriteria = (strbooleanField & “= falseâ€)
Else
…….
…….
rst.FindFirst strCriteria
……
……..
 
Ad

Advertisements

M

missinglinq via AccessMonster.com

As the name would suggest, strCriteria has to be a string! Try

strCriteria = "[strbooleanField]" & “= falseâ€

Also, shouldn't there be an equal sign instead of a hyphen here?

Const strTableQueryName-“test_qryâ€

should be:

Const strTableQueryName = “test_qryâ€
 
Ad

Advertisements

M

Marshall Barton

don588765 said:
I have problem writing the strCriteria declaration, the following is my code.
I guess my strCriteria declaration is incorrect, any help will be appreciated


Private Sub Form_Load()
Const strTableQueryName-“test_qry”
Dim db As DAO.Database,rst As DAO.Recordset
Set db=CurrentDb
Set rst = db.OpenReordset(strTableQueryName, dbOpenDyneaset, dbReadOnly)
TestFunction rst:=rst, strBooleanField:=”uplink”
End Sub

Sub TestFunction(rst As Recordset, strBooleanField As String)
……
…….
If srt.(strBooleanField) = false Then
strCriteria = (strbooleanField & “= false”)
Else
…….
…….
rst.FindFirst strCriteria
……
……..


You also spelled rst wrong and referenced the field
incorrectly:

If rst(strBooleanField) = false Then

Because most of these would have been caught by the
compiler, it would have been a lot easier for you to compile
your code using the Debug - Compile menu item.

If you were already doing that, then please don't retype
your code in your post. That just introduces typos that
will seriously get in the way of figuring out what your
problem might be. Instead, use Copy/Paste to post the real
code you are using.
 

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