LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel data to an Access table

Les,

I did some looking over the weekend and did not have any examples handy to
send to you but, my suggestion that follows should work.

Try having your button call a VBA module that sets up an ADO connection to
your ACCESS dbase and runs an append qry. Then have it clear the fields as
indicated previously.

For example:

Step 1: Create your connection from Excel to Access using ADO
Dim oConn As New ADODB.Connection

Set oConn.ConnectionString = "DSN=AccessDB;...."

Step 2: Write an append query using your fields and the ADO connection
Step 3: Clear the cell contents as before.




I think that if you look on google or elsewhere you can locate the complete
syntax for the statement.

Despite not knowing VBA very well you should be able to use your VB skills
and the resources you locate to build the statement. I dont have an example
or I would send it to you.

Once again, perhaps someone else has one handy.

Hope this at least serves to guide you in a diretion that works until other
offer their opinions as well.

Best of luck!

RS




"Les" wrote in message
...
Hi Rick,

First let me thank you for your help here!! I will try to play with some
ideas and hope to hear from you if you find the time.

Once again thanks my friend,

Les

"Rick S." wrote in message
...
Les,

Sending the data to Access is a bit more complicated, more for the fact

that
usually the data transfer is the other directions (at least in my
experience). Let me think about the easiest method to send you an

example
that you can apply with little complication. I will try to get back to

you
by Tuesday if possible....Monday's are horrible for me.

the issue of clearing the cells....thats very simple. Create your

macro
( or hidden command that you reference through code or button (which we

we
chat about next week) using the code below:

Private Sub CommandButton1_Click()
ActiveSheet.Unprotect
Range("B4").ClearContents
Range("B6").ClearContents
Range("C4").ClearContents
Range("C6").ClearContents
Range("D4").ClearContents
Range("D6").ClearContents
ActiveSheet.Protect
End Sub

I did this the easiest method possible for you to see how its done
basically.

Go to Tools, Macros, Visual Basic Editor and double-click on the sheet

name
containing the cells. Paste the above code in the sheet. Change the

cells
to reference your specifc cells, then save the sheet. Close it and go

back
to your form(worksheet).

Now, create the command button and link the code you pasted to its name.

When you save and go back to your sheet it will clear the cells upon
clicking it.

Hope this helps and I will try to get back with you when possible.

And,
if
I can come up with an easy way to send an example.

Maybe someone else has a good clear example already?

Best of luck....

Later,

RS
"Les" wrote in message
...
Hi Rick,

Unfortunately I am not as familiar with VBA as I am in VB-6. Can you

show
me how to set up the command button to send data from XL to Access (ie

send
XLS.fileABC.column to ACCESS.fieldname etc....)? What command

button
event should I use and how to null out those 6 fields. If it is

involved
then I understand.

Lets say for example I have 3 fileds called field1, field2 and field3

that
has data in them and that upon clicking the button I want to send it

to
(appended of course) to Access with fields access1, access2 and

access3.
Does this example make life easier?

Thanks,

Les

"Rick S." wrote in message
...
Les,

If you know VBA you can try writing a reinitialization statement in

the
module and call it after the append to ACCESS, else, write a macro

to
clear
the fields and call the macro after the command button to append the

data
to
ACCESS. The best approach depends on your comfort with VBA and/or

macros.

Rick



"Les" wrote in message
...
I have an excel spreadsheet set up like a form. This form has 6

pieces
of
data the user puts in. Once they are filled in the user needs to

click
on
a
command button and have those 6 pieces of data dumped (appended)

into
an
Access database. After that is done I want to clear the 6 fields

where
the
data was in Excel.

Can someone help me?

Thanks,

Les














 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting data to Excel pivot table from Access Pat Dools Excel Discussion (Misc queries) 3 October 22nd 08 06:49 PM
Access Create Excel Pivot Table Data Source [email protected] Excel Discussion (Misc queries) 0 July 12th 06 09:35 PM
Data from Excel to Access Table Secret Squirrel Excel Discussion (Misc queries) 11 December 2nd 05 11:58 PM
New Excel data does not appear in linked Access table JohnL Excel Discussion (Misc queries) 0 October 7th 05 04:31 PM
updating Access table with Excel data newbie[_2_] Excel Programming 2 July 11th 03 03:06 AM


All times are GMT +1. The time now is 03:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"