Solved

Help with opening recordsets needed

Posted on 2011-03-21
7
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 58
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

690 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