473,395 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

record set base on two criteria

222 100+
Hello Everybody

I'm using this code to set a record set with 1 criteria .. It is working

Dim mysql As String
mysql = "SELECT * FROM [Invoiceoutdetail]" _
& "WHERE([customerID])= " & [custID] & ""

Set db = CurrentDb()
Set rst = db.OpenRecordset(mysql, dbOpenDynaset)

what I'm trying to do is to replace mysql by this code to use 2 criterias ..
Dim mysql As String
mysql = "SELECT * FROM [Invoiceoutdetail]" _
& "WHERE([customerID])= " & [custID] & ""_
& And "[Barecodedetail]='" & [Barecodedetail] & "')"

I always have an error ...

Does someone Know How we can use double criterias for a record set ?
Jun 3 '07 #1
3 1665
Try declaring a separate sql string:

Expand|Select|Wrap|Line Numbers
  1. Dim SQLStr as string
  2. SQLStr = "Select * from tblInvoiceoutdetail & WHERE customerID = " & custID 
  3. SQLStr = SQLStr & " AND Barecodedetail = " & Barecodedetail
  4.  
  5. .. And if MySQL then
  6. SQLStr = SQLStr & ";"
  7. then
  8. SetRS = CurrentDb.Openrecordset (SQLStr)
  9.  
  10.  
if this doesn't work... I'm not sure how to proceed... took me awhile to find this solution.

theAybaras
Jun 3 '07 #2
JConsulting
603 Expert 512MB
Hello Everybody

I'm using this code to set a record set with 1 criteria .. It is working

Dim mysql As String
mysql = "SELECT * FROM [Invoiceoutdetail]" _
& "WHERE([customerID])= " & [custID] & ""

Set db = CurrentDb()
Set rst = db.OpenRecordset(mysql, dbOpenDynaset)

what I'm trying to do is to replace mysql by this code to use 2 criterias ..
Dim mysql As String
mysql = "SELECT * FROM [Invoiceoutdetail]" _
& "WHERE([customerID])= " & [custID] & ""_
& And "[Barecodedetail]='" & [Barecodedetail] & "')"

I always have an error ...

Does someone Know How we can use double criterias for a record set ?
Dim mysql As String
mysql = "SELECT * FROM [Invoiceoutdetail] WHERE" & _
" [customerID]= " & me.[custID] & " And '" [Barecodedetail]='" & me.[Barecodedetail] & "';"
Jun 3 '07 #3
wassimdaccache
222 100+
Both worked ThanK you ...
Jun 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Steven Stewart | last post by:
Hi there, I have posted about this before, but yet to arrive at a solution. I am going to try to explain this better. I have an Employees table and a Datarecords table (one-to-many...
6
by: John | last post by:
Hi, I have simple database based on 3 tables. Relationship is 'one to many' between table 1 and 2, also between 2 and 3 table'one to many'. I have made form where I enter data in all 3 tables....
2
by: Lyn | last post by:
If I have a form where the RecordSource property is set to the name of a table, then on opening the SingleForm form I can cycle through all the records in the table one at a time via Next and...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
4
by: kufre | last post by:
How can I use three criteria to find a record? I've done this before where I only use one criteria to find a record and set the focus to that criteria only. Thanks in advance.
22
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
1
by: emmaruwa | last post by:
I have a form with two text boxes (in its details section) that pull data from two fields in my database table. This same form also has a button beside the text boxes which is supposed to open...
2
by: crisostomofred | last post by:
I have a report with it's source from a query. The query calls data from 3 related tables. The report is a meeting agenda and I only want to attach a snapshot report to my email based on the...
6
jinalpatel
by: jinalpatel | last post by:
I am using following code for searching records. 'Purpose: Build up the criteria string form the non-blank search boxes, and apply to the form's Filter. 'Notes: 1. We tack " AND " on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.