473,397 Members | 1,949 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,397 software developers and data experts.

Scan for each matched record

In my code, i tried to scan for each record in my database that
matched certain criteria and then display it in a subform. I used the
following codes but it will only display last record, i want to
display all records. Pls help. Thanks

Set rs = Me.Recordset.Clone
rs.FindFirst fmonth & " And " & fyear
Me.Bookmark = rs.Bookmark
Do Until rs.EOF
rs.FindNext fmonth & " or " & fyear
book = rs.Bookmark
rs.MoveNext
Loop
Me.Bookmark = book

Regads,
Daniel
Nov 12 '05 #1
2 1834
Forms work best with recordsets based on queries, and searching for a set of
matches in a database is best done with a query of the database. Thus,
displaying a list of matches in a subform is best done by setting the form's
recordsource to the SQL for a query that finds and returns the rows in
quesiton.

strSQL = SELECT * FROM <mytable> WHERE " & fmonth & " And " & fyear
Me.RrecordSource = strSQL

On 3 Feb 2004 08:48:54 -0800, da*******@time.net.my (Daniel Tan) wrote:
In my code, i tried to scan for each record in my database that
matched certain criteria and then display it in a subform. I used the
following codes but it will only display last record, i want to
display all records. Pls help. Thanks

Set rs = Me.Recordset.Clone
rs.FindFirst fmonth & " And " & fyear
Me.Bookmark = rs.Bookmark
Do Until rs.EOF
rs.FindNext fmonth & " or " & fyear
book = rs.Bookmark
rs.MoveNext
Loop
Me.Bookmark = book

Regads,
Daniel


The code you wrote does find each match, but then doesn't do anything with
each match when it finds it. At the end of the loop, it has found the last
match, then it sets the form's bookmark to point to that last row that it
found.
Nov 12 '05 #2
Hi Steve

Thanks for reply. Do i need to loop the SQL statement ? THanks.

Daniel


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Nige | last post by:
To save me re-inventing the wheel, does anyone have a function to capitalise each word in form data? I was thinking along the lines of capitalise the first letter of the string, then any other...
4
by: Rajesh Kumar Mallah | last post by:
Hi, We need to implement following logic efficiently. SELECT * from some_table where .... IF rows_matched = 1 THEN use the single row that matched.
6
by: robert | last post by:
just got out of a "class" on EXPLAIN, from a 390/v6 maven. was told that ACCESSTYPE = 'R' in the plan_table meant a TableSpace scan. hmmmm. next step up (or down, depending on your outlook)...
3
by: Tom Turner | last post by:
Here's the background on my situation. The question follows --- We have 600 units of mail going from our business to various Post Offices every morning. Every unit is accompanied by a paper...
4
by: smshahriar | last post by:
Hi, I want to scan from the following string all the hex numbers and populate an array of integers: 0x27 0x00 0x30 0x00 0x33 0x00 0x36 0x00
10
by: Dia | last post by:
At the company I work job applicants are required to do a little test. The human resource manager recently had a candidate who claimed one of the questions was ambiguous. Dependent upon the...
2
by: David Smithz | last post by:
Hi, If you run a query which has a WHERE statement in which has a few possibilities separated OR statements, e.g. Select * from table where (Afield = 2) OR (Bfield = 2) OR (Cfield = 2) In...
2
by: steve i | last post by:
Greetings; I created a db form which allows for scanned entries from a scan gun, we programmed the gun to "tab" therefore allowing a next line entry of data into the form.... Problem; What do I...
5
by: =?Utf-8?B?TWlrZSBE?= | last post by:
This is a difficult question: I need to be able to input data via hand-scanner into a web page textbox, but it needs to be done more than once. The user will scan one card after another and in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.