G
Guest
i have a cmd button on my sub-form which i want to enable when the value of a
listbox control called "Continuing" is "Yes". if "Continuing" is "No", the
cmd btn (called "Duplicate") should be disabled.
my vba on the "Continuing" is:
Private Sub Continuing_AfterUpdate()
Me.Duplicate.Enabled = False
If Me.Continuing.Value = "Yes" Then Me.Duplicate.Enabled = True
End Sub
and if works fine.
since changing the property of the "Duplicate" button has the effect of
displaying the change on every instance of the form's in the user's view
(since it's a continous form we're using and not a single form), it looks
funny to see the button's property seem to change for those records that are
not impicated, i.e. other than the current record's.
i should add at this point that the underlying table has a pk consisting of
5 controls and that i created five unbound txt controls which i dropped into
the sub-form's header section called txtCurKey1,....,txtCurKey5.
now, i have written some vba which compiles and does not seem to yet do what
i want (see below):
Private Sub Form_Current()
Dim txtCurKey1 As Long, txtCurKey2 As Integer, txtCurKey3 As String,
txtCurKey4 As String, txtCurKey5 As Date
txtCurKey1 = Me.Patient_Number
txtCurKey2 = Me.Cycle
txtCurKey3 = Me.AE_Description
txtCurKey4 = Me.Subtype
txtCurKey5 = Me.Onset
If txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And txtCurKey3 =
Me.AE_Description And _
txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset And Me.Continuing =
"Yes" Then
Me.Duplicate.Enabled = True
ElseIf txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And
txtCurKey3 = Me.AE_Description _
And txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset And Me.Continuing =
"No" Then Me.Duplicate.Enabled = False
ElseIf Not (txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And
txtCurKey3 = Me.AE_Description And _
txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset) And Me.Continuing =
"Yes" Then Me.Duplicate.Enabled = True
ElseIf Not (txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And
txtCurKey3 = Me.AE_Description _
And txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset) And Me.Continuing
= "No" Then Me.Duplicate.Enabled = False
' Me.Duplicate.Enabled = True
End If
'If Me.Continuing.Value = "Yes" Then Me.Duplicate.Enabled = True
End Sub
my goal is to get a2k to know when to display "Duplicate" as enabled; i
think that it'd look 'good' to the user to see that when "Continuing" is
"Yes" whether or not he's 'on' a record that the "Duplicate" button is
enabled. conversely, that it'd somehow be 'good' for the user to see that the
"Duplicate" button is disabled when the "Continuing" field was a "No" whether
or not......
and to have the "enabled" property of the "Duplicate" cmdbtn able to get
switched at will when the user's 'on' a record.
anyone out there see the achilees' heel in this?
thanks for the bandwidth.
listbox control called "Continuing" is "Yes". if "Continuing" is "No", the
cmd btn (called "Duplicate") should be disabled.
my vba on the "Continuing" is:
Private Sub Continuing_AfterUpdate()
Me.Duplicate.Enabled = False
If Me.Continuing.Value = "Yes" Then Me.Duplicate.Enabled = True
End Sub
and if works fine.
since changing the property of the "Duplicate" button has the effect of
displaying the change on every instance of the form's in the user's view
(since it's a continous form we're using and not a single form), it looks
funny to see the button's property seem to change for those records that are
not impicated, i.e. other than the current record's.
i should add at this point that the underlying table has a pk consisting of
5 controls and that i created five unbound txt controls which i dropped into
the sub-form's header section called txtCurKey1,....,txtCurKey5.
now, i have written some vba which compiles and does not seem to yet do what
i want (see below):
Private Sub Form_Current()
Dim txtCurKey1 As Long, txtCurKey2 As Integer, txtCurKey3 As String,
txtCurKey4 As String, txtCurKey5 As Date
txtCurKey1 = Me.Patient_Number
txtCurKey2 = Me.Cycle
txtCurKey3 = Me.AE_Description
txtCurKey4 = Me.Subtype
txtCurKey5 = Me.Onset
If txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And txtCurKey3 =
Me.AE_Description And _
txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset And Me.Continuing =
"Yes" Then
Me.Duplicate.Enabled = True
ElseIf txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And
txtCurKey3 = Me.AE_Description _
And txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset And Me.Continuing =
"No" Then Me.Duplicate.Enabled = False
ElseIf Not (txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And
txtCurKey3 = Me.AE_Description And _
txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset) And Me.Continuing =
"Yes" Then Me.Duplicate.Enabled = True
ElseIf Not (txtCurKey1 = Me.Patient_Number And txtCurKey2 = Me.Cycle And
txtCurKey3 = Me.AE_Description _
And txtCurKey4 = Me.Subtype And txtCurKey5 = Me.Onset) And Me.Continuing
= "No" Then Me.Duplicate.Enabled = False
' Me.Duplicate.Enabled = True
End If
'If Me.Continuing.Value = "Yes" Then Me.Duplicate.Enabled = True
End Sub
my goal is to get a2k to know when to display "Duplicate" as enabled; i
think that it'd look 'good' to the user to see that when "Continuing" is
"Yes" whether or not he's 'on' a record that the "Duplicate" button is
enabled. conversely, that it'd somehow be 'good' for the user to see that the
"Duplicate" button is disabled when the "Continuing" field was a "No" whether
or not......
and to have the "enabled" property of the "Duplicate" cmdbtn able to get
switched at will when the user's 'on' a record.
anyone out there see the achilees' heel in this?
thanks for the bandwidth.