473,699 Members | 2,433 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ho to goto to a specific record using the Docomd.GoToReco rd

7 New Member
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.GoToRecor d Like this:

"DoCmd.GoToReco rd 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.GoToReco rd acDataForm, "ADV_FORM", acGoTo, [ADV]![code]=8"

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

Thanks for any help
May 29 '07 #1
3 59137
puppydogbuddy
1,923 Recognized Expert Top Contributor
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.GoToRecor d Like this:

"DoCmd.GoToReco rd 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.GoToReco rd acDataForm, "ADV_FORM", acGoTo, [ADV]![code]=8"

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

Thanks for any help
Try using the DoCmd.FindRecor d, 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
vostrixos
7 New Member
I've tried the DoCmd.FindRecor d but nothing huppents.Actual ly what i get from the debuging is that DoCmd.FindRecor d don't make the record which i want as the current record.Am i doing something rong?

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

DoCmd.FindRecor d 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
1481
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 that I can't reference a certain article, such as /article.aspx?id=10221. Adding the record number does nothing since the iFrame references the article.aspx. What can I do to pass a variable to the iFrame? Thanks!
3
5714
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 message that displays to the user when there is no more record to got to was something different then **You can't go to the specific record** Has anyone ever changed to say something different?
1
5022
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 Exit of the 'Report Number' text box, the code can scan through to see if that report number exists and if so, jump to it. I was looking through and thought maybe docmd.GoToRecord, but that seem to only move a specific number of records - not via...
10
5024
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 but no good for Field search: DoCmd.GoToRecord , , acGoTo, 19 And I know is NOT recommended.
2
11275
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. I'm using this code: Private Sub SpecimenNum_DblClick(Cancel As Integer) DoCmd.OpenForm "RDDevice", , , " = '" & Me! & "'" End Sub
3
27295
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
11581
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 type in any part of a social security number and when you do I want it to take the user to the closest match SSN record in the continuous form. For Example you have three records SSN LastName
1
6574
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
5577
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 is no match then go to the new record for new entry. I want this to happen when the form open. The purpose of this is due to a multi-user environment application that I want the user to see his/her profile when open the form. Below is the code...
0
8687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9034
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8914
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6534
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.