I have two forms that a user can enter data for the same records. One form is a summary form with just minimal information and on this form I have a control button that takes the user to another form that allows more details to be entered for that record. I have the following codes that can take the user back and forth from the summary form to the detail form. These codes are working well if the user edits and existing record...that is, when the record is updated on one form and the user switches to the other form, the user can see their updates. I am having a problem with new records, however. I would like the user to be able to enter some data in the summary form for a new record and then be able to go to the detail form to add more data. Is there a way to get the data to update in the summary form on a new record so that when the user goes to the detail form the new record shows up. Here are the codes I am using to go from one form to the other. frmMainTEST = the summary form and frmMain = the detail form.
Code:
Private Sub Command206_Click()
On Error GoTo Err_Command206_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMain"
stLinkCriteria = "[QuestID]=" & Me![QuestID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmMainTEST"
Exit_Command206_Click:
Exit Sub
Err_Command206_Click:
MsgBox Err.Description
Resume Exit_Command206_Click
End Sub
Code to go back to the frmMainTEST
Code:
Private Sub Command193_Click()
'code courtesy of Paul Baldy - http://www.baldyweb.com/Bookmark.htm
Dim rs As Object
Dim lngBookmark As Long
'set a variable to the current record
lngBookmark = Me.QuestID
'open the new form
DoCmd.OpenForm "frmMainTEST"
DoCmd.Close acForm, "frmMain"
'take it to the selected record
Set rs = Forms!frmMainTEST.RecordsetClone
rs.FindFirst "QuestID = " & lngBookmark
Forms!frmMainTEST.Bookmark = rs.Bookmark
Set rs = Nothing
End Sub