Quote:
Originally Posted by vostrixos
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