Access 2010 - Can Subforms be linked together? (1 Viewer)

mizliz55

New member
Local time
Today, 12:57
Joined
Jun 1, 2015
Messages
1
I have an issue with my subforms. I have a main table called ECNs and three tables called EngApp, PurApp, and ProdApp. These three tables have fields named Approved (checkbox), Denied (checkbox), and Date plus a field to link it back to the ECNs table and a unique ID (AutoNumber).

Each subform created off the three tables has user level permissions. I have the user level permissions working as to who can modify each subform and if Approved is checked then Denied is blank and vise versa. However, I don't want User2 to modify the PurApp subform until User1 has checked Approved box in the EngApp subform.

This is the code I have so far:
Private Sub Form_Open(Cancel As Integer)
If Forms!frmLogin!cboUser.Column(4) = 5 Then
Me.AllowEdits = True
Me.AllowAdditions = True
Else
Me.AllowEdits = False
Me.AllowAdditions = False
End If
End Sub
Private Sub PurApp_Click()
If Me.PurApp = True Then
Me.PurDenied = False
Me.PurDate = Date
Else
Me.PurDenied = ""
End If
End Sub
Private Sub PurDenied_Click()
If Me.PurDenied = True Then
Me.PurApp = False
Me.PurDate = Date
Else
Me.PurApp = ""
End If
End Sub


But this will not work. It says it does not recognize the form EngApp (even though I have linked the two tables).
If Forms!EngApp!EngApp = True Then
Me.AllowEdits = True
Me.AllowAdditions = True
Else
Me.AllowEdits = False
Me.AllowAdditions = False
End If
End Sub

Any thoughts or help as to how to fix this would be greatly appreciated!

Thanks!
 

vbaInet

AWF VIP
Local time
Today, 17:57
Joined
Jan 22, 2010
Messages
26,374
Welcome to the forum mizliz55! :)

First thing to point out is that Approved and Declined are mutually exclusive, it's either Approved or Declined. With your current setup you could potentially end up with both fields check or unchecked at the same time. You really want to combine that field and use two grouped radio buttons instead of checkboxes.

Secondly, your logic is a bit confusing. The Approved/Declined field is a field level validation but you want to use it on a form validation? Can you possibly re-think or explain further.
 

TimW

Registered User.
Local time
Today, 17:57
Joined
Feb 6, 2007
Messages
90
Hi Just a quick response as I should be somewhere else :)
Agreed with vbaInet as Approved & Declined should be mutually exclusive.
Also, if you are referring to a subform or another sub form then the syntax changes.
You need to refer to the parent form and then the subform container etc..
Look it up :)
I have to go....
 

Users who are viewing this thread

Top Bottom