By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

Running an Append Query Usin a form Button

P: 3
Hey All,

A friend of mine told me about this forum, I've been pooling my hair out for the past few nights trying to figure this out =( . I'm a complete "noob" when it comes to ACCESS.

I'm trying to use Access to create a form that will append new client's data into a table, this table will then be "Mail Merged" to MS Word to print out a letter with rate quotes and such.

What I have done so FAR:

1. Created a table in "Tables" called "Customer" (this table has all the needed fields like: First Name, Last Name and so on.)

2. Created an Append Query in "Queries"

3. Used the forms wizard to create a form

4. Added a button "Add Record"

Now, how do I get that button to run the query to append newly-entered data into the "Customer" Table?

Big hugs will be provided in exchange for valuable information.

Thanks,
CHUBBYCARROL
Mar 14 '07 #1
Share this Question
Share on Google+
6 Replies


FireMedic
P: 18
Hi Carol,

If I understand this right (and my apologies if I don't) why not just set the record source of your form to be your customers table and just add new record to add a new customer. That way you have no need of an append query at all. Again that is if I understand the situation correctly this would be the least complicated method.

Let me know if I'm out to lunch on this.
Mar 14 '07 #2

P: 3
TRUE!,

Thank you, but how how do i get that "add record" button to work? Do i need to create an event?
Mar 14 '07 #3

P: 23
Yes, you do need to put some code in the button's On Click event.
Try this code:

DoCmd.SetWarnings False
DoCmd.OpenQuery "Query Name"
DoCmd.SetWarnings True
Mar 14 '07 #4

P: 23
Ps. You should include DoCmd.SetWarnings False and DoCmd.SetWarnings True only when you are sure that your Query works fine.
Mar 14 '07 #5

P: 3
THANK YOU,

It works now, but it looks like it doesn't add records it replaces them.

Here is the SQL for my append query:

INSERT INTO Customer ( ID, [Last Name], [First Name], [Street Address], [City, State], [Zip Code], [Face Ammount1], Term1, Premium1, Insurer1, [Face Ammount2], Term2, Premium2, Insurer2, [Face Ammount3], Term3, Premium3, Insurer3, Rating, Phone1, Phone2, Agent )
SELECT Customer.ID, Customer.[Last Name], Customer.[First Name], Customer.[Street Address], Customer.[City, State], Customer.[Zip Code], Customer.[Face Ammount1], Customer.Term1, Customer.Premium1, Customer.Insurer1, Customer.[Face Ammount2], Customer.Term2, Customer.Premium2, Customer.Insurer2, Customer.[Face Ammount3], Customer.Term3, Customer.Premium3, Customer.Insurer3, Customer.Rating, Customer.Phone1, Customer.Phone2, Customer.Agent
FROM Customer;

Is it wrong?

Or, is there a way to bypass the query and have the form add records directly into the table?

!CHUBBY
Mar 14 '07 #6

NeoPa
Expert Mod 15k+
P: 31,441
Hey All,

A friend of mine told me about this forum, I've been pooling my hair out for the past few nights trying to figure this out =( . I'm a complete "noob" when it comes to ACCESS.

I'm trying to use Access to create a form that will append new client's data into a table, this table will then be "Mail Merged" to MS Word to print out a letter with rate quotes and such.

What I have done so FAR:

1. Created a table in "Tables" called "Customer" (this table has all the needed fields like: First Name, Last Name and so on.)

2. Created an Append Query in "Queries"

3. Used the forms wizard to create a form

4. Added a button "Add Record"

Now, how do I get that button to run the query to append newly-entered data into the "Customer" Table?

Big hugs will be provided in exchange for valuable information.

Thanks,
CHUBBYCARROL
If you run through the Form Wizard again and create one against the [Customer] table, then it should create a form where data is automatically saved to the table when you move from one record to another (Or choose Save Record from the Record menu). This should be the default situation using the Wizard I would have thought.
In case I'm not being clear enough, this means you should not have to use an APPEND query (or even any UPDATE queries) to save the data to the table.
Mar 16 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.