Solved

Help with opening recordsets needed

Posted on 2011-03-21
7
186 Views
Last Modified: 2012-05-11


I am trying to open a recordset with two criteria items.  Customer_No in the recordset should match the Customer_No field on my form and the "Active" field in the recordset should be a "Y".   Both fields are text.

I can't seem to get the syntax for the 'active' correct.  Below is a snippet of what I am trying.

rst.FindFirst "Customer_No = '" & Me.Customer_No & "' " And "Active = '"Y"'

Where am I going wrong?

Thanks.
0
Comment
Question by:snyperj
  • 3
7 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
try this

rst.FindFirst "Customer_No = '" & Me.Customer_No & "' And Active = 'Y'"
0
 
LVL 33

Expert Comment

by:jppinto
Comment Utility
Please try like this:

rst.FindFirst "Customer_No = '" & Me.Customer_No & "' And Active = 'Y'"

jppinto
0
 
LVL 33

Expert Comment

by:jppinto
Comment Utility
@snyperj: we both posted at the same time with eqqual answers! Can you please explain why you only accepted one of the answers?
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility

  BTW, you both beat me<g>.

  However I would have added that I don't like to use single quotes, but rather:

rst.FindFirst "Customer_No = " & Chr$(34) & Me.Customer_No  & Chr$(34) & " And Active = "  & Chr$(34) & "Y"  & Chr$(34)

  Chr$(34) is the quote character (") and to me, it's a lot easier to read this.  It also avoids the problem with names where the single quote (') may be embedded in the data.

JimD.


0
 
LVL 33

Expert Comment

by:jppinto
Comment Utility
Jim, allow me to disagree on your point of view. If both posted the exact same answer at the exact same time, it should had been a split between both questions, not all points assign to only one of the questions. This is how I see this. But it's OK, you don't need to reopen the question or reasign the points, I'm used to this already. Sometimes we win, others we loose...

regards,

jppinto
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now