469,292 Members | 1,454 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,292 developers. It's quick & easy.

Running an Append Query Usin a form Button

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
6 18532
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
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
Gerhard
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
Gerhard
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
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
32,173 Expert Mod 16PB
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.

Similar topics

2 posts views Thread by John | last post: by
2 posts views Thread by Ray Holtz | last post: by
2 posts views Thread by SolomonShavitzMetsFan | last post: by
4 posts views Thread by franc sutherland | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.