Solved edit record button not taking me to the correct record in second form (1 Viewer)

LeeHutchins

New member
Local time
Today, 11:27
Joined
Nov 3, 2020
Messages
13
I have a edit record button on my Landing Page that should take me to another form "ContractDetail" so it can be edited, however it will only take me to the first record it is not finding the record I have selected

Code:
Dim ContractID As String
   ContractID = Me.ID
      DoCmd.Close acForm, "Landing Page"
      DoCmd.OpenForm "ContractDetail"
      DoCmd.FindRecord (ContractID)

I have a command box to test the me.ID and this is returning the correct ID value but yet it still isnt finding the correct record in the ContractDetail form.

thanks for any help in advance
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:27
Joined
Oct 29, 2018
Messages
21,357
How about trying it this way?
Code:
DoCmd.OpenForm "ContractDetail", , , "ContractID=" & Me.ID
DoCmd.Close acForm, Me.Name
 

LeeHutchins

New member
Local time
Today, 11:27
Joined
Nov 3, 2020
Messages
13
How about trying it this way?
Code:
DoCmd.OpenForm "ContractDetail", , , "ContractID=" & Me.ID
DoCmd.Close acForm, Me.Name
Fantastic, that has worked for me :D thanks so much, the previous way was working until ive changed something, still fumbling my way through learning VBA and even access.

thanks again 🙂
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:27
Joined
Oct 29, 2018
Messages
21,357
Fantastic, that has worked for me :D thanks so much, the previous way was working until ive changed something, still fumbling my way through learning VBA and even access.

thanks again 🙂
Hi. You're welcome. Good luck with your project.
 

Users who are viewing this thread

Top Bottom