PDA

View Full Version : Basic question: I would like to create a button using vba to add and remove customers



wedd
09-23-2010, 05:52 AM
I have a basic vba code question. I would like to create 2 buttons on a form; one to remove a customer's details and another button to add a new customer? What type of code would i need to write for this action

Thanks :friends:

Imdabaum
09-23-2010, 07:36 AM
It depends on how your form is set up. When you say remove, are you wanting a delete of the customer or just nulling out the details that exist on a related record so you can edit the information?

wedd
09-23-2010, 07:56 AM
I would like to be able to delete a customer and employee record should they leave the company. Although the admin team will be entering data and making bookings for the customers I would like to restrict them the rights to editing the data...that responsibility will be left to the management to do

Imdabaum
09-23-2010, 08:05 AM
Will the delete button not work? The wizard will walk you through a simple delete button.

geekgirlau
09-28-2010, 07:27 PM
Actually, although the wizard can walk you through the process, it's not a good idea - you will lose all history for those customers and employees.

I'd suggest instead that for both customers and employees you have a yes/no field for "Active". You can then still display historical records, but stop users selecting inactive customers or employees for new records.

Imdabaum
09-29-2010, 08:45 AM
Actually, although the wizard can walk you through the process, it's not a good idea - you will lose all history for those customers and employees.

I'd suggest instead that for both customers and employees you have a yes/no field for "Active". You can then still display historical records, but stop users selecting inactive customers or employees for new records.

And that's why you're the moderator and I'm just little me.:thumb
That's a much better solution.