Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 804
  • Last Modified:

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!



0
hytekth
Asked:
hytekth
  • 3
  • 2
1 Solution
 
flavoCommented:
Hi hytekth,
> DoCmd.GoToRecord Record:=Forms![UpdateClaimForm]!FaultID(SelectedRec)
Rather than that, try:
Forms!UpdateClaimForm.Recordset.FindFirst "FaultID = " & SelectedRec
Dave :-)
0
 
hytekthAuthor Commented:
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 :-/
0
 
flavoCommented:
You don't need all
DoCmd.GoToRecord Record:= Forms!UpdateClaimForm.Recordset.FindFirst "FaultID = " & SelectedRec

Just:
Forms!UpdateClaimForm.Recordset.FindFirst "FaultID = " & SelectedRec

Dave
0
 
hytekthAuthor Commented:
Brilliant! Works like a charm :-) Thank you very much!
0
 
flavoCommented:
Glad to help!

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

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now