hide control in continuous subform?

R

r

I have a continuous subform which shows details about the item selected on
the main form.

I want the user to be able to ADD new records using the continuous subform
(using the last record that appears as a "new" record), and to begin the
process, they need to select an ID from a dropdown box. Problem is, I don't
want the dropdown box active for the rows which have EXISTING data - because
changing the ID for existing data would cause problems. Is there a way to
say "if the ID field is null" or "if the record is new" then show the
dropdown, otherwise don't? I realize the dropdown is the same control for
all the rows that will display in my continuous form, so I'm not sure this
is possible.

If not, what can I do for a workaround?

I could create a method in the subform header to add new records, but then I
don't know how to get rid of that last "empty row" of data. If I set the
form's properties to turn off the ability to ADD records, the last row will
go away, but then I won't be able to add records using the form in ANY way.

???

Suggestions, or possible solutions for my idea listed above (optionally hide
the control if data is in it)?

Thanks in advance.
 
S

Steve Schapel

R,

Following your own suggestions, there are several approaches you could
take to this.

On the Enter event of the combobox, you could put code to shift the
focus somewhere else, e.g.
If IsNull(Me.ID) Then
Me.ID.Dropdown
Else
Me.SomeOtherControl.SetFocus
End If

It may be applicable to set the AllowEdits property of the form to No,
assuming you don't want any of the data to be altered after a record has
been created.

You could set the form's AllowAdditions property to No, and then use
unbound controls in the Form Header for the entry of new records.
Therefore the ID combobox in the form itself has its Locked property set
to Yes (and probably Enabled set to No). Or maybe even replace it with
a textbox? And then you can simply run an Append Query (maybe a little
command button) to add a new record based on the data entered in the
unbound header controls, and then Refresh the form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top