SubForm No Visible

B

Bob Vance

On my form if Combo box [cbOwner]is Null my SubForm Not Show
[SubPayModePayChild]
Can I have this in My Open Form event?
 
J

John W. Vinson

On my form if Combo box [cbOwner]is Null my SubForm Not Show
[SubPayModePayChild]
Can I have this in My Open Form event?

Not sure what you mean here. Do you want the subform to be invisible if the
combo box value is NULL? What if it's NULL in one record, and non-Null in some
other record?

Try putting code in the form's Current event:

Private Sub Form_Current()
Me.SupPayModePayChild.Visible = Not IsNull(Me!cbOwner)
End Sub
 
B

Bob Vance

Thanks John could not get that to work, but wrote this and it seems to work:
Created a check box that is true when cbOwner has data ....Regards Bob

If ckbClient.value = 0 Or IsNull(ckbClient.value) Then
ckbClient.value = -1
Me.Refresh
If ckbClient.value = True Then
SubPayModePayChild.Visible = True

Else
SubPayModePayChild.Visible = False
End If
John W. Vinson said:
On my form if Combo box [cbOwner]is Null my SubForm Not Show
[SubPayModePayChild]
Can I have this in My Open Form event?

Not sure what you mean here. Do you want the subform to be invisible if
the
combo box value is NULL? What if it's NULL in one record, and non-Null in
some
other record?

Try putting code in the form's Current event:

Private Sub Form_Current()
Me.SupPayModePayChild.Visible = Not IsNull(Me!cbOwner)
End Sub
 
B

Bob Vance

Entered same code on AfterUpdate in combobox and on Open in The form event
Regards Bob

Bob Vance said:
Thanks John could not get that to work, but wrote this and it seems to
work:
Created a check box that is true when cbOwner has data ....Regards Bob

If ckbClient.value = 0 Or IsNull(ckbClient.value) Then
ckbClient.value = -1
Me.Refresh
If ckbClient.value = True Then
SubPayModePayChild.Visible = True

Else
SubPayModePayChild.Visible = False
End If
John W. Vinson said:
On my form if Combo box [cbOwner]is Null my SubForm Not Show
[SubPayModePayChild]
Can I have this in My Open Form event?

Not sure what you mean here. Do you want the subform to be invisible if
the
combo box value is NULL? What if it's NULL in one record, and non-Null in
some
other record?

Try putting code in the form's Current event:

Private Sub Form_Current()
Me.SupPayModePayChild.Visible = Not IsNull(Me!cbOwner)
End Sub
 
B

Bob Vance

John, My Combo box has this code which works fine when I select a Owner, it
activates my subform to the correct records, Is it possible to use this code
so as when I Scroll with my own control that it will show the correct
records in the subform, at the moment if I Scroll or use this command to
open my form the subform does not change..........Thanks Bob
--------------------------------------------
On Error GoTo Err_cmddelete_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAccountStatus"

stLinkCriteria = "[BillID]=" & Me![tbBillID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmddelete_Click:
Exit Sub

Err_cmddelete_Click:
'MsgBox Err.Description
Resume Next
-----------------------------------------------------------------
Private Sub cbOwnerID_AfterUpdate()
Dim nRtnValue As Integer
If IsNull(cbOwnerID1.Column(0)) Then
nRtnValue = vbYes
Else
nRtnValue = MsgBox("Are you sure you want to change owner, you may to be
able to restore changes once done !", vbCritical + vbYesNo)

End If
If nRtnValue = vbYes Then
cbOwnerID1.value = cbOwnerID.value
Form("SubPaymentShowChild").Form.Filter = "[OwnerID]=" & Me.cbOwnerID
Form("SubPaymentShowChild").Form.FilterOn = True
Form("SubPayModePayChild").Form.Filter = "[OwnerID]=" & Me.cbOwnerID
Form("SubPayModePayChild").Form.FilterOn = True
If Len(Me.cbOwnerID.value & "") > 0 Then
Me.cbOwnerID.Locked = True
Dim rsFullAmtPaid As ADODB.Recordset
Set rsFullAmtPaid = New ADODB.Recordset



tbShowTotal.value = cbOwnerID.Column(5)
End If
End If
End Sub
Bob Vance said:
Entered same code on AfterUpdate in combobox and on Open in The form event
Regards Bob

Bob Vance said:
Thanks John could not get that to work, but wrote this and it seems to
work:
Created a check box that is true when cbOwner has data ....Regards Bob

If ckbClient.value = 0 Or IsNull(ckbClient.value) Then
ckbClient.value = -1
Me.Refresh
If ckbClient.value = True Then
SubPayModePayChild.Visible = True

Else
SubPayModePayChild.Visible = False
End If
John W. Vinson said:
On my form if Combo box [cbOwner]is Null my SubForm Not Show
[SubPayModePayChild]
Can I have this in My Open Form event?

Not sure what you mean here. Do you want the subform to be invisible if
the
combo box value is NULL? What if it's NULL in one record, and non-Null
in some
other record?

Try putting code in the form's Current event:

Private Sub Form_Current()
Me.SupPayModePayChild.Visible = Not IsNull(Me!cbOwner)
End Sub
 
Top