On Click Event for Unbound

S

scott04

Hi everyone. I have a form that contain a subform. At the top of my form I
have 5 unbound textboxes that represent Date Scheuled, Lead Auditor, Audit
Team, Department, and Audit Scope. Underneath these 5 unbound textboxes is a
command button to click to add to schedule. I am trying to code the command
button on click event to insert whatever i type in the 5 boxes to my table
T_audit but i do not have much experience doing this. Any help is
appreciated.
 
B

Beetle

Is there a reason why you are using unbound text boxes in the first place?

Some of the data you describe - Lead Auditor, Audit Team, Department - would
typically be stored in tables, with appropriate foreign keys in your Audits
table. Then you would use, for example, a combo box to store the value.

Even if you don't have the info stored in your db, why not just type the
values directly into your subform?
 
S

scott04

The subform gives me all audits Where (t_audit.datecomplete) is Null. The
form basically gives management the option to add departments that it would
like be audited. My hope is they can go into that form and add the 5 fields,
once complete hit the button and the data would save to my table T_Audit and
automatically go to the subform since the datecomplete would be null
 
B

Beetle

I would caution against doing it that way and here is one (there are many)
example of the types of problems you can encounter.

Let's suppose you have an auditor named Bill Smith. If you let your users just
type the name into an unbound text box and use code to add the name to
your audits table, then over time you will end up with values like this in
your
table;

Bill Smith
B. Smith
Bil Smith
Billl Smth
Bill Smitg
Vill snith

etc., etc.

Now sometime in the future, when you want to determine how many audits
were done by Bill Smith, it will be difficult, if not impossible, to get
accurate
results.

I suppose you could have someone else go through records and do spell
checking if your company enjoys paying people to do unnecessary work.

The info about Bill Smith, and your other auditors/employees
(First Name, Last Name, hire date, etc.) should be stored in a table with
a unique ID number. The only value that should be stored in the Audits table
is his unique ID number, not his name. Then you would have your users select
his name from a predefined list like a combo box.

The same goes for Departments, Audit Teams, etc.

Now, if for some reason you're not concerned about data integrity, I see no
reason to use unbound text boxes. Just set up a form or subform with text
boxes bound to those fields in the table, an allow them to just type
whatever value they want directly into the table via the form. That is
essentailly what you would be doing anyway, so why add the extra work
of having to write an insert or update SQL statement behind your button?

If you are determined to use your current method, post back to get examples
of how to code your button, but I don't think it's a good idea.
 

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