473,326 Members | 2,173 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,326 software developers and data experts.

Ho to goto to a specific record using the Docomd.GoToRecord

Hi all I need some help.

I'm working on a project where i need to move on some records depending the value that the user chooses from a list box.I use the DoCmd.GoToRecord Like this:

"DoCmd.GoToRecord acDataForm, "ADV_FORM", acGoTo, LIST.Value"

Where LIST.Value is the primery key of a table and that's Auto Number.
The problem is that if the key has the value 8,the current record will be the 8th and not the record that has 8 as key (The numbering has gaps 1-2-4-7-8...etc)

What i want is to move to the current record to the one that has the specified key.The help file talks about expression as a fourth argument of the DoCmd so I tried:

"DoCmd.GoToRecord acDataForm, "ADV_FORM", acGoTo, [ADV]![code]=8"

But didn't worked.Is there a way to do that whith DoCmd.GoToRecord,or should I try SQL?(I will be needing help with this too..)

Thanks for any help
May 29 '07 #1
3 58857
puppydogbuddy
1,923 Expert 1GB
Hi all I need some help.

I'm working on a project where i need to move on some records depending the value that the user chooses from a list box.I use the DoCmd.GoToRecord Like this:

"DoCmd.GoToRecord acDataForm, "ADV_FORM", acGoTo, LIST.Value"

Where LIST.Value is the primery key of a table and that's Auto Number.
The problem is that if the key has the value 8,the current record will be the 8th and not the record that has 8 as key (The numbering has gaps 1-2-4-7-8...etc)

What i want is to move to the current record to the one that has the specified key.The help file talks about expression as a fourth argument of the DoCmd so I tried:

"DoCmd.GoToRecord acDataForm, "ADV_FORM", acGoTo, [ADV]![code]=8"

But didn't worked.Is there a way to do that whith DoCmd.GoToRecord,or should I try SQL?(I will be needing help with this too..)

Thanks for any help
Try using the DoCmd.FindRecord, which allows you to use the keyvalue as the search key.

see this link for an explanation and example syntax:

http://www.blueclaw-db.com/docmd_findrecord_example.htm
May 30 '07 #2
I've tried the DoCmd.FindRecord but nothing huppents.Actually what i get from the debuging is that DoCmd.FindRecord don't make the record which i want as the current record.Am i doing something rong?

DoCmd.FindRecord makes the record that looks for current or not?The help file isn't helpfull at all...
May 30 '07 #3
puppydogbuddy
1,923 Expert 1GB
I've tried the DoCmd.FindRecord but nothing huppents.Actually what i get from the debuging is that DoCmd.FindRecord don't make the record which i want as the current record.Am i doing something rong?

DoCmd.FindRecord makes the record that looks for current or not?The help file isn't helpfull at all...
The default findRecord command will return the record you want if there is a match to the field that currently has focus, Consequently, you need to set focus on the field that you want to search before you execute the FindFirst as shown below:
Expand|Select|Wrap|Line Numbers
  1. Me.List.SetFocus                   '  set focus on the field to be searched
  2. DoCmd.FindRecord List.value , , False , , True , , False 
  3.  
May 30 '07 #4

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

Similar topics

3
by: Hugh G. Johnson | last post by:
I have a knowledgebase (KB) system I installed into my existing dynamicly driven site. I used iFrame to grab the KB and place it in the content area of the page. This works great, but I realize now...
3
by: Simone | last post by:
Hello!!! Here is the thing. I have had this problem and I want to address it now where in the next and previous button DoCmd.GoToRecord , , acNext - DoCmd.GoToRecord , , acPrevious I wish the...
1
by: Regnab | last post by:
The record's primary key is the report number. The form in which data is entered or modified has this Report Number at the top. I would like to know if I could use SQL in the VB code so that on...
10
by: ApexData | last post by:
Hello How do I goto a specific record in a BOUND form when the form has a primary index of ID which is autonumbered. I need to visit 4 seperate records, one at a time. This works for RecNO...
2
by: nkoske | last post by:
I have a form with a subform in datasheet view and I have a event on one of the fields in the subform, so that the user can double click it and go to expanded information based on that field. ...
3
by: cmp80 | last post by:
I have a database that I am using to store student data. There are two tables and two forms to display the data: Tables tbStudent tbRE Forms fmStudent fmRE
3
by: eighthman11 | last post by:
Using Access 2000. I have a continuous form which for simplicity sack has two fields Social Security Number and Last Name. In the header of the continuous form I have a textbox where you can...
1
by: cvillav | last post by:
Hello, I am new to Access and this forums, I have two tables and two forms to display the data. Tables Tbuilding Tcriteria Forms fmbuilding
4
by: JoeKid09 | last post by:
Hi All, Good morning! I am working on a form that is bound to a table with user’s name. I need to be able to go to specific record base on a text box value which contain user login name, if there...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.