spartansFC
Programmer
Hi
I have a form called frmPeople which has a subform called frmPeopleSubPlacementHistory.
frmPeople has the table structure
lngPeopleID (PK)
frmPeopleSubPlacementHistory has the table structure of
lngPlacementID (PK)
lngPeopleID (FK)
there can be more than 1 placement which is where my problem is.
I need to edit the frmPlacement and also be able to add new records to frmPlacement, on frmPeople i have 2 command buttoms AddNew and EditPlacement
I've sorted out the EditPlacement by using the code
and then on frmplacement i have
How do i Open frmPlacement to a new record but to the specific peopleID, i could use peopleID instead of lngPlacementID when editing a placement but it won't work if there are more than 1 placement as it will only look at the first placement.
the code i've started with for NewPlacement is:
Anyone have any ideas
Michael
I have a form called frmPeople which has a subform called frmPeopleSubPlacementHistory.
frmPeople has the table structure
lngPeopleID (PK)
frmPeopleSubPlacementHistory has the table structure of
lngPlacementID (PK)
lngPeopleID (FK)
there can be more than 1 placement which is where my problem is.
I need to edit the frmPlacement and also be able to add new records to frmPlacement, on frmPeople i have 2 command buttoms AddNew and EditPlacement
I've sorted out the EditPlacement by using the code
Code:
Private Sub EditPlacement_cmdbutton_Click()
On Error GoTo Err_EditPlacement_cmdbutton_lest_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPlacement"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me!frmPeopleSubPlacementHistory.Form!lngPlacementID
Exit_EditPlacement_cmdbutton_lest_Click:
Exit Sub
Err_EditPlacement_cmdbutton_lest_Click:
MsgBox Err.Description
Resume Exit_EditPlacement_cmdbutton_lest_Click
End Sub
and then on frmplacement i have
Code:
Private Sub Form_Open(Cancel As Integer)
If Len(Me.OpenArgs) > 0 Then
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[lngPlacementID]=" & Me.OpenArgs
Me.Bookmark = rs.Bookmark
End If
End Sub
How do i Open frmPlacement to a new record but to the specific peopleID, i could use peopleID instead of lngPlacementID when editing a placement but it won't work if there are more than 1 placement as it will only look at the first placement.
the code i've started with for NewPlacement is:
Code:
Private Sub NewPlacement_cmdbutton_Click()
On Error GoTo Err_NewPlacement_cmdbutton_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPlacement"
'DoCmd.OpenForm stDocName, , , stLinkCriteria, acNormal
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me!PeopleID
DoCmd.GoToRecord , , acNewRec
Exit_NewPlacement_cmdbutton_Click:
Exit Sub
Err_NewPlacement_cmdbutton_Click:
MsgBox Err.Description
Resume Exit_NewPlacement_cmdbutton_Click
End Sub
Anyone have any ideas
Michael