Access and SQL, upating an sql table? please help!

R

RON

OK I have posted things about sql before but have still not been able to do
it.....here is what i am trying to do, maybe someone can be of some help.

I have an SQL Server table setup with USERID, AMOUNT, CARDNUMBER

In access I have an UNBound form with textboxes for people to be able to
enter in USERID, AMOUNT, and CARDNUMBER

I also have a button on this form when clicked I would Like it to take
whatever is in the 3 textboxes on the form and put them into the
corresponding areas in my sql table

Can someone please show me how to code for this click event?

So if I entered on the form,
USERID: 1112
AMOUNT: 340.00
CARDNUMBER: 4443444344434443

then
1112, 340.00 and 4443444344434443 would get sent to the corresponding areas
of my table in sql.

thanks
 
S

strive4peace

Hi Ron,

strSQL = "INSERT INTO Tablename " _
& " (USERID, AMOUNT, CARDNUMBER) " _
& " SELECT " & me.UserID_controlname _
& ", " & me.Amount_controlname _
& ", " & me.CardNumber_controlname & ";"
currentdb.execute strSQL

this assumes that you are linked to tablename

if any of these values are actually stored as text, they
will need to be delimited

ie:

....
& ", '" & me.CardNumber_controlname & "';"

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 

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