Copy an active record on one form to another

Mechele

Registered User.
Local time
Today, 08:57
Joined
Jan 25, 2002
Messages
121
I have a form where the user selects the name of a hospital. Once they have selected the hospital, the form checks to see if a record is already created for that hospital. If so, another form is open and the hospital's record should be displayed. If not, a new record is created and they can complete the record with information. My problem is when the first form finds that a record is already created for the selected hospital. I can't get the record found in the first form to display in the second form when the second form is opened. The user uses the second form to create or update information (Create/Update Member Information Form). The first form is just a selection screen (MemberListForm). What am I doing wrong?

Private Sub Command20_Click()
If IsNull(MemberList) Then
MsgBox ("You must select a hospital before you can make this selection.")
DoCmd.Close acForm, "ValueHighlightsForm"
DoCmd.OpenForm "MembershipInformationForm"
Me.MemberList.Enabled = True
Else
'Find records.
Dim stDocName As String
Dim stLinkCriteria As String
Dim rs As Object

sSQL = "SELECT * From ValueHighlights WHERE MemberName = '" & Forms!MembershipInformationForm.MemberName & "'"
Set rs = CurrentDb.OpenRecordset(sSQL)

If Not rs.BOF And Not rs.EOF Then
MsgBox ("A participation matrix has already been created for this member. You will be forwarded to the update screen.")
stDocName = "ValueHighlightsForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!ValueHighlightsForm.Bookmark = rs.Bookmark
DoCmd.Maximize
Else
stDocName = "ValueHighlightsForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
Forms!ValueHighlightsForm.DataEntry = True
Forms!ValueHighlightsForm!Memid = Forms!MembershipInformationForm!Memid
Forms!ValueHighlightsForm!MemberName = Forms!MembershipInformationForm!MemberName
End If
rs.Close
DoCmd.Close acForm, "MembershipInformationForm"
End If
End Sub:(
 
stLinkCriteria

I don't see where you assign a value to stLinkCriteria.
 

Users who are viewing this thread

Back
Top Bottom