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

DoCmd.FindRecord ends at last record

hello,

I have a code like:
Expand|Select|Wrap|Line Numbers
  1. Private sub button1_Click()
  2. DoCmd.FindRecord Me.fieldname.Value, acStart, , acSearchAll, , , False
  3. end sub
  4.  
but the problem is that the command stops searching at the last record. so the records before the current record are not searched. I thought with acSearchAll it should search the entire record list.

I need some help here.
Oct 1 '09 #1
8 5456
Plater
7,872 Expert 4TB
I don't know what object you are using, but DataReader can only be searched through once.
Oct 1 '09 #2
I am working with Ms access forms and the code above is a control for a button. I don't want to start searching from the first record (this works fine). the docs show that the above code should search from the current record to the end of the set, then start from the beginning to the current record. in the end all records should be searched. I don't know why this doesn't work for me.

I may have posted this question in the wrong place
Oct 1 '09 #3
Plater
7,872 Expert 4TB
So this is VBA? I will move it then.
Oct 1 '09 #4
NeoPa
32,556 Expert Mod 16PB
Thanks Plater :)

Try :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.FindRecord(FindWhat:=Me.FieldName, _
  2.                       Match:=acEntire, _
  3.                       Search:=acSearchAll, _
  4.                       OnlyCurrentField:=acCurrent, _
  5.                       FindFirst:=True)
Please let us know if this works for you.
Oct 1 '09 #5
yes it is vba, thanks for moving it; i tried to figure out how to do it.

thanks NeoPa for the code. it begins always from the first record. also it would always find the first hit. My code begins from the next record after the current record and should cycle through the entire record set back to the current record just like the Access 'Find Next'.

I'm still trying to find out why it ends at the last record instead of continuing from the first record back to the current record.
Oct 2 '09 #6
NeoPa
32,556 Expert Mod 16PB
I looked in Help & it says little more than listing the available values for the parameters. Essentially, it's not a lot of ...

Anyway. I suggest your next step is to experiment with the three parameters (Match, Search & FindFirst) to see if you can come up with a combination that does it as you need. Unfortunately, it is sometimes necessary to do some research (in this case trial & error) before being able to understand things correctly.
Oct 2 '09 #7
I couldn't get the docmd.findrecord to work like I wanted so I implemented my own search over the recordset.

Thanks for your suggestions.
Oct 5 '09 #8
NeoPa
32,556 Expert Mod 16PB
That seems like a shame. Sorry I couldn't be more help.

A self-made search should only be noticeably slower if the number of records is quite large though.
Oct 5 '09 #9

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

Similar topics

1
by: STeve Lefevre | last post by:
Hey folks -- I'm using the DoCmd.GoToRecord , , acNext to jump to the next record after the user enters a value. The problem is, it throws an error if it's already on the last record! What's the...
2
by: chanchito_cojones | last post by:
hi there, I am needing some help with a database I am putting together. The database works off of a main Form, which then has buttons on it that will open up other forms. The problem I am having...
1
by: Doug W. | last post by:
I want to merge just one record from a query in my Access database into a Word document. This allows me to send one letter to one client by first extracting the client's address data, personal...
5
by: Stack | last post by:
Hello, I have my data sorted on date desc in my form (multiple recs/table style). When I want to insert a new record (with my self made button and vba code(DoCmd.GoToRecord , , acNewRec)) the...
1
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. ...
7
by: BUmed | last post by:
Well, in need to find a record using a command button so I set up a FindRecord in a macro. Now the person wants to be able to find all the records that meet the last name criterian so I thought I...
4
by: RAG2007 | last post by:
Hi Having some problems with docmd.findrecord, getting runtime error 2162, in an adp, sql server back end. On my main form, I have a continuous view subform giving a list of subrecords within...
0
by: Ben Lahoy | last post by:
Hi! My problem is basically in a search modal window, where the user is allowed to make a selection on which option to take. After selecting an option and then giving the data to search, 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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.