Make Button Visible/Invisible If and populate new record on click

G

Guest

I would like a certain button to be visible on a continuous subform only if a
combobox on the same continuous form is a certain value. I know how to test
for the value in the combobox, and I know how to make the form
visible/invisible. I don't know what event to fire this procedure from
though. Obviously, it will have to be fired on the AfterUpdate event of the
combobox in question, but what about when the form first loads, or when the
selected record in the main form changes?

When this button is clicked I would like a new record to be created in the
subform with the same values for each control as the record the button was
clicked from. How do you do this in code? Remember, this is on a continuous
subform (I don't know if that makes a difference).

Dave
 
W

Wolfgang Kais

Hello David.

David M C said:
I would like a certain button to be visible on a continuous subform
only if a combobox on the same continuous form is a certain value.

Making the button invible will hide it in every record of the continous
subform. Therfore, I suggest to place it somewhere oputside the detail
section of the continuous form.
I know how to test for the value in the combobox, and I know how to
make the form visible/invisible.

The form? Wasn't it the button?
I don't know what event to fire this procedure from though.
Obviously, it will have to be fired on the AfterUpdate event of the
combobox in question, but what about when the form first loads,
or when the selected record in the main form changes?

Yes, also in these cases, that is OnCurrent of the main form.
When this button is clicked I would like a new record to be created
in the subform with the same values for each control as the record the
button was clicked from. How do you do this in code?

You can store the values in variables, move to a new record and set the
values for the fields from the variables.
Ot try to use the clipboard using

RunCommand acCmdSelectRecord
RunCommand acCmdCopy
RunCommand acCmdPasteAppend
Remember, this is on a continuous subform
(I don't know if that makes a difference).

When changing a property (like "visible") of a control in the detail section
of a form, this affects the display of all records, because all records are
displayed using the same set of controls ("the detail section"). The
difference between using a continuous form and a single form is that you can
see the changes for a control in multiple records at once, but you probably
don't want that ("hiding a button in the detal section" means "hiding that
button for all records").
 
G

Guest

Looks like I'll have to consider another way of creating the record.
Basically, my form records transactions. These transactions have two types,
Booked and Paid. When the user inputs the Booked type (selectable through a
combobox), I'd like to give them the option of automatically creating the
relevant Paid record based on the chosen record. I can't do this without some
form of user input (like clicking a button) because sometimes more/less will
be Paid than Booked.

Dave
 
W

Wolfgang Kais

Hello David.

Looks like I'll have to consider another way of creating the record.
Basically, my form records transactions. These transactions have two
types, Booked and Paid. When the user inputs the Booked type
(selectable through a combobox), I'd like to give them the option
of automatically creating the relevant Paid record based on the chosen
record. I can't do this without some form of user input (like clicking a
button) because sometimes more/less will be Paid than Booked.

So why not place the button on the header of the subform?
Use a sub procedure that makes the button visible/invisible depending
of the value of the combo box.
Call the procedure from the AfterUpdate event of the combo box and
from the OnCurrent event of the subform.
 

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