hi,
maybe you can solve my problem. I have a form(clients) with primClientID and putted two subforms in it, both linked to the (client)form primClientID.
In de clientform i look for a persons name and if it's found,subform1 shows me all his contracts with the possibility to add records in the Continuous subform1.
Continuous Subform2 shows the subcontracts from each selected contract in subform1.
subform2source = query based on a recordcheckboxfield'view' in subform1).
When i click on a contract and add a new subcontract the contractID from subform1 is copy't to subform2 as reference dependend on the recordselector from subform1.
Problem : when i start a new subcontract in subform2 and subform1 selectionrecord is on a new record, I can't change it to the last record subform1 because the uniek key from subform2 is empty.
Private Sub Form_BeforeInsert(Cancel As Integer)
If IsNull(Forms!Clientform!subform1!PrimClientID) Then
MsgBox "Select first a contract", vbOKOnly, "message"
'recordselector on last record subform1 and continue adding record subform2
Else
duplcontractID = Forms!Clientform!subform1!contractID
End If
End Sub
I tried a second solution :
Private Sub Subform1_Current()
If NewRecord Then
Forms![formClienten]![subform2].Form.AllowAdditions = False
Else
Forms![formClienten]![subform2].Form.AllowAdditions = True
End Sub
I get a error (he can't find the object) on load but when i end the debugger the funktion works perfectly. Me.forms ... isn't a solution and ...[subform2].subForm... neather
I gess my (sub)formstring isn't right!
This is not a form with a subform in a subform because then i would only see 'one' contract with several subcontracts (and thats easy done)
thanks already
maybe you can solve my problem. I have a form(clients) with primClientID and putted two subforms in it, both linked to the (client)form primClientID.
In de clientform i look for a persons name and if it's found,subform1 shows me all his contracts with the possibility to add records in the Continuous subform1.
Continuous Subform2 shows the subcontracts from each selected contract in subform1.
subform2source = query based on a recordcheckboxfield'view' in subform1).
When i click on a contract and add a new subcontract the contractID from subform1 is copy't to subform2 as reference dependend on the recordselector from subform1.
Problem : when i start a new subcontract in subform2 and subform1 selectionrecord is on a new record, I can't change it to the last record subform1 because the uniek key from subform2 is empty.
Private Sub Form_BeforeInsert(Cancel As Integer)
If IsNull(Forms!Clientform!subform1!PrimClientID) Then
MsgBox "Select first a contract", vbOKOnly, "message"
'recordselector on last record subform1 and continue adding record subform2
Else
duplcontractID = Forms!Clientform!subform1!contractID
End If
End Sub
I tried a second solution :
Private Sub Subform1_Current()
If NewRecord Then
Forms![formClienten]![subform2].Form.AllowAdditions = False
Else
Forms![formClienten]![subform2].Form.AllowAdditions = True
End Sub
I get a error (he can't find the object) on load but when i end the debugger the funktion works perfectly. Me.forms ... isn't a solution and ...[subform2].subForm... neather
I gess my (sub)formstring isn't right!
This is not a form with a subform in a subform because then i would only see 'one' contract with several subcontracts (and thats easy done)
thanks already