Link to home
Start Free TrialLog in
Avatar of hytekth
hytekth

asked on

DoCmd.GoToRecord - Access2000

I'm sure this is easy but I can't figure it out!

I'm running a Listbox of records which display all record from a given company, this is on a seperate form from the actual infomation for each record.
I'm trying to open up the specific record that a user selects but I can't make it open the right record.  So far the code looks like:

Private Sub UpdateClaimBtn_Click()

   Dim stDocName As String
   Dim stLinkCriteria As String
   Dim SelectedRec As String

SelectedRec = List9.ItemData(List9.ListIndex + 1)
' use to work out the record ID of the users selection

stDocName = "Claim_Table"
DoCmd.OpenForm stDocName, acViewNormal
DoCmd.GoToRecord Record:=Forms![UpdateClaimForm]!FaultID(SelectedRec)

End Sub

Ideally I would like to open the corrisponding "FaultID" record on the Claim_Table form.  

Any ideas or advice would be wonderful!



Avatar of flavo
flavo
Flag of Australia image

Hi hytekth,
> DoCmd.GoToRecord Record:=Forms![UpdateClaimForm]!FaultID(SelectedRec)
Rather than that, try:
Forms!UpdateClaimForm.Recordset.FindFirst "FaultID = " & SelectedRec
Dave :-)
Avatar of hytekth
hytekth

ASKER

I tried

DoCmd.GoToRecord Record:= Forms!UpdateClaimForm.Recordset.FindFirst "FaultID = " & SelectedRec

But it came up with a Expected: end of statement arround the "FaultID = " section :-/
ASKER CERTIFIED SOLUTION
Avatar of flavo
flavo
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hytekth

ASKER

Brilliant! Works like a charm :-) Thank you very much!
Glad to help!

Good luck with the rest of your project(s)
Dave