Open form

  • Thread starter Thread starter Gee
  • Start date Start date
G

Gee

My code is at the bottom....
When I click on Command328 I go from "Steps Form"
to "Steps MISC Form" just like I need to.
My problem is that rather than go to the record that I'm
on in Steps Form, it goes to the first record. I have a
control called "Unique ID" that is in both. How do I get
it to jump to the "Steps MISC Form" that has a
matching "Unique ID"?
(I know this is gonna be simple and I'm gonna feel like a
dope}
Thanks in advance for your help!

Private Sub Command328_Click()
On Error GoTo Err_Command328_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Steps MISC Form"
DoCmd.OpenForm stDocName, , stLinkCriteria


Exit_Command328_Click:
Exit Sub

Err_Command328_Click:
MsgBox Err.Description
Resume Exit_Command328_Click

End Sub
 
stLinkCriteria = "[Unique ID] = " & Me![Unique ID] '*****
DoCmd.OpenForm stDocName, , stLinkCriteria

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
That didn't quite work. It sent me to the right form, but
not to the same ID. It sent me to a new form.
-----Original Message-----

stLinkCriteria = "[Unique ID] = " & Me![Unique ID] '*****
DoCmd.OpenForm stDocName, , stLinkCriteria

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

My code is at the bottom....
When I click on Command328 I go from "Steps Form"
to "Steps MISC Form" just like I need to.
My problem is that rather than go to the record that I'm
on in Steps Form, it goes to the first record. I have a
control called "Unique ID" that is in both. How do I get
it to jump to the "Steps MISC Form" that has a
matching "Unique ID"?
(I know this is gonna be simple and I'm gonna feel like a
dope}
Thanks in advance for your help!

Private Sub Command328_Click()
On Error GoTo Err_Command328_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Steps MISC Form"
DoCmd.OpenForm stDocName, , stLinkCriteria


Exit_Command328_Click:
Exit Sub

Err_Command328_Click:
MsgBox Err.Description
Resume Exit_Command328_Click

End Sub


.
 
Then you need to rename [Unique ID] to whatever your primary key name is.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Gee said:
That didn't quite work. It sent me to the right form, but
not to the same ID. It sent me to a new form.
-----Original Message-----

stLinkCriteria = "[Unique ID] = " & Me![Unique ID] '*****
DoCmd.OpenForm stDocName, , stLinkCriteria

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

My code is at the bottom....
When I click on Command328 I go from "Steps Form"
to "Steps MISC Form" just like I need to.
My problem is that rather than go to the record that I'm
on in Steps Form, it goes to the first record. I have a
control called "Unique ID" that is in both. How do I get
it to jump to the "Steps MISC Form" that has a
matching "Unique ID"?
(I know this is gonna be simple and I'm gonna feel like a
dope}
Thanks in advance for your help!

Private Sub Command328_Click()
On Error GoTo Err_Command328_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Steps MISC Form"
DoCmd.OpenForm stDocName, , stLinkCriteria


Exit_Command328_Click:
Exit Sub

Err_Command328_Click:
MsgBox Err.Description
Resume Exit_Command328_Click

End Sub


.
 
Back
Top