Solved

Help with opening recordsets needed

Posted on 2011-03-21
7
210 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 35179911
try this

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

Expert Comment

by:jppinto
ID: 35179915
Please try like this:

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

jppinto
0
 
LVL 33

Expert Comment

by:jppinto
ID: 35179973
@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
ID: 35180213

  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
ID: 35180390
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

861 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