Opening a form from a form and finding a matching record

Judy

Registered User.
Local time
Today, 12:41
Joined
Sep 26, 2000
Messages
34
Hopefully I can explain this correctly....
I have a form that shows a current record. When a check box is clicked to true it marks the current record as a historical record, opens another form (acFormAdd) and the user adds a new record. On the second forms close event, I tried a few options to go to the new record on the first form.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm1"
stLinkCriteria = "[RecordID]=" & Me![RecordID]

Forms![frm1]![cboSelectRecordID].Requery
Forms![frm1]![cboSelectName].Requery
DoCmd.OpenForm stDocName, , stLinkCriteria

This example opened frm1 with the new record, but it was filtered to only the new record, not the entire record source. Then I tried:


Dim stDocName As String

stDocName = "frm1"

Forms![frm1]![cboSelectRecordID].Requery
Forms![frm1]![cboSelectName].Requery
DoCmd.OpenForm stDocName
Forms![frm1].RecordsetClone.FindFirst "[RecordID] = " & Me![RecordID]
Forms![frm1].Bookmark = Forms![frm1].RecordsetClone.Bookmark

This didn't work either.

Any suggestions???

Thanks!
 
Have a try:

Dim stDocName As String

stDocName = "frm1"

' Forms![frm1]![cboSelectRecordID].Requery
' Forms![frm1]![cboSelectName].Requery
DoCmd.OpenForm stDocName
Forms![frm1].RecordsetClone.FindFirst "[RecordID] = " & Me![RecordID]
msgbox "me!RecordID=" & Me![RecordID]
Forms![frm1].Bookmark = Forms![frm1].RecordsetClone.Bookmark
 
Thanks for the help. It didn't work at first -- I ended up having to requery the form. This is what I did:

Dim stDocName As String

stDocName = "frm1"

DoCmd.OpenForm stDocName
Forms![frm1].Requery
Forms![frm1].RecordsetClone.FindFirst "[RecordID] = " & Me![RecordID]
msgbox "me!RecordID=" & Me![RecordID]
Forms![frm1].Bookmark = Forms![frm1].RecordsetClone.Bookmark
Forms![frm1]![cboSelectRecordID].Requery
Forms![frm1]![cboSelectName].Requery
Forms![frm1]![cboSelectRecordID].SetFocus

Now it works great! Thanks for the help!

Have a great day,

Judy
 

Users who are viewing this thread

Back
Top Bottom