473,569 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Append Data To Table From Excel

There is an Access table on the network. 15 users who do not have Access are
connected to the network. Is there a way for each user to be able to enter one
or more rows containing 3 or 4 columns to Excel on his machine and then press a
button or something and append that data to the Access table on the network? Any
suggestions on what the code would be?

Thank you very much!

Martin
Nov 12 '05 #1
4 13457
One way you could handle this is to create a user form for the Excel sheet
that has the data on it. The form would simply have a command button on it
with the following code attached to its on click event:

Private Sub CommandButton1_ Click()
'declare variables for ado connection and sql command
Dim oCon, strSql

'these variables will store data from excel spreadsheet
Dim strLastName As String, strFirstName As String, strTitle As String

'instantiate the connection object, and specify connection properties
Set oCon = CreateObject("a dodb.connection ")
oCon.provider = "microsoft.jet. oledb.4.0"

'open the connection
'you can use a UNC to a file on a server
'ex: \\myserver\data \employees.mdb"
oCon.Open "C:\temp\employ ees.mdb"

'my spreadsheet data starts on second row. first row contains headers,
so i'm ignoring that
Dim intRow As Integer
intRow = 2

'stop the process as soon as we run out of data in the excel spreadsheet
While Not Sheet1.Cells(in tRow, 1) = ""

'assign values from spreadsheet to our variables
strLastName = Sheet1.Cells(in tRow, 1)
strFirstName = Sheet1.Cells(in tRow, 2)
strTitle = Sheet1.Cells(in tRow, 3)

'construct an insert query using our spreadsheet values
strSql = "insert into employees(lastn ame,firstname,t itle) values('"
& _
strLastName & "','" & strFirstName & "','" & strTitle & "');"

'execute the sql command
oCon.Execute strSql

'advance our counter to the next row number and activate the first
cell
intRow = intRow + 1
Sheet1.Cells(in tRow, 1).Activate
Wend
'close and destroy our ado objects
oCon.Close
Set oCon = Nothing
End Sub

This worked ok in office xp... I think it would work in 2000.

Anyway, I hope this helps.
-Mike

"Martin" <md******@earth link.net> wrote in message
news:Cx******** *******@newsrea d1.news.atl.ear thlink.net...
There is an Access table on the network. 15 users who do not have Access are connected to the network. Is there a way for each user to be able to enter one or more rows containing 3 or 4 columns to Excel on his machine and then press a button or something and append that data to the Access table on the network? Any suggestions on what the code would be?

Thank you very much!

Martin

Nov 12 '05 #2
Mike,

Thanks for a great response!!!

Martin
"Mike S." <do******@nores ponse.com> wrote in message
news:Bs******** *************** @bgtnsc04-news.ops.worldn et.att.net...
One way you could handle this is to create a user form for the Excel sheet
that has the data on it. The form would simply have a command button on it
with the following code attached to its on click event:

Private Sub CommandButton1_ Click()
'declare variables for ado connection and sql command
Dim oCon, strSql

'these variables will store data from excel spreadsheet
Dim strLastName As String, strFirstName As String, strTitle As String

'instantiate the connection object, and specify connection properties
Set oCon = CreateObject("a dodb.connection ")
oCon.provider = "microsoft.jet. oledb.4.0"

'open the connection
'you can use a UNC to a file on a server
'ex: \\myserver\data \employees.mdb"
oCon.Open "C:\temp\employ ees.mdb"

'my spreadsheet data starts on second row. first row contains headers,
so i'm ignoring that
Dim intRow As Integer
intRow = 2

'stop the process as soon as we run out of data in the excel spreadsheet
While Not Sheet1.Cells(in tRow, 1) = ""

'assign values from spreadsheet to our variables
strLastName = Sheet1.Cells(in tRow, 1)
strFirstName = Sheet1.Cells(in tRow, 2)
strTitle = Sheet1.Cells(in tRow, 3)

'construct an insert query using our spreadsheet values
strSql = "insert into employees(lastn ame,firstname,t itle) values('"
& _
strLastName & "','" & strFirstName & "','" & strTitle & "');"

'execute the sql command
oCon.Execute strSql

'advance our counter to the next row number and activate the first
cell
intRow = intRow + 1
Sheet1.Cells(in tRow, 1).Activate
Wend
'close and destroy our ado objects
oCon.Close
Set oCon = Nothing
End Sub

This worked ok in office xp... I think it would work in 2000.

Anyway, I hope this helps.
-Mike

"Martin" <md******@earth link.net> wrote in message
news:Cx******** *******@newsrea d1.news.atl.ear thlink.net...
There is an Access table on the network. 15 users who do not have Access

are
connected to the network. Is there a way for each user to be able to enter

one
or more rows containing 3 or 4 columns to Excel on his machine and then

press a
button or something and append that data to the Access table on the

network? Any
suggestions on what the code would be?

Thank you very much!

Martin


Nov 12 '05 #3
Mike,

A twist to my original post ---

I found the way to build an HTML form with the text fields I need. Would you
know the code to attach to the Submit button to add the data in the text fields
to the table in the Access database on an intranet.

I'm asking here because I'm wondering if your ADO connection would be used.

Thanks for all your help!

Martin
"Martin" <md******@earth link.net> wrote in message
news:sk******** ********@newsre ad1.news.atl.ea rthlink.net...
Mike,

Thanks for a great response!!!

Martin
"Mike S." <do******@nores ponse.com> wrote in message
news:Bs******** *************** @bgtnsc04-news.ops.worldn et.att.net...
One way you could handle this is to create a user form for the Excel sheet
that has the data on it. The form would simply have a command button on it
with the following code attached to its on click event:

Private Sub CommandButton1_ Click()
'declare variables for ado connection and sql command
Dim oCon, strSql

'these variables will store data from excel spreadsheet
Dim strLastName As String, strFirstName As String, strTitle As String

'instantiate the connection object, and specify connection properties
Set oCon = CreateObject("a dodb.connection ")
oCon.provider = "microsoft.jet. oledb.4.0"

'open the connection
'you can use a UNC to a file on a server
'ex: \\myserver\data \employees.mdb"
oCon.Open "C:\temp\employ ees.mdb"

'my spreadsheet data starts on second row. first row contains headers,
so i'm ignoring that
Dim intRow As Integer
intRow = 2

'stop the process as soon as we run out of data in the excel spreadsheet
While Not Sheet1.Cells(in tRow, 1) = ""

'assign values from spreadsheet to our variables
strLastName = Sheet1.Cells(in tRow, 1)
strFirstName = Sheet1.Cells(in tRow, 2)
strTitle = Sheet1.Cells(in tRow, 3)

'construct an insert query using our spreadsheet values
strSql = "insert into employees(lastn ame,firstname,t itle) values('"
& _
strLastName & "','" & strFirstName & "','" & strTitle & "');"

'execute the sql command
oCon.Execute strSql

'advance our counter to the next row number and activate the first
cell
intRow = intRow + 1
Sheet1.Cells(in tRow, 1).Activate
Wend
'close and destroy our ado objects
oCon.Close
Set oCon = Nothing
End Sub

This worked ok in office xp... I think it would work in 2000.

Anyway, I hope this helps.
-Mike

"Martin" <md******@earth link.net> wrote in message
news:Cx******** *******@newsrea d1.news.atl.ear thlink.net...
There is an Access table on the network. 15 users who do not have Access

are
connected to the network. Is there a way for each user to be able to enter

one
or more rows containing 3 or 4 columns to Excel on his machine and then

press a
button or something and append that data to the Access table on the

network? Any
suggestions on what the code would be?

Thank you very much!

Martin



Nov 12 '05 #4
Mike,

Sorry, I posted in the wrong place the first time.

A twist to my original post ---

I found the way to build an HTML form with the text fields I need. Would you
know the code to attach to the Submit button to add the data in the text fields
to the table in the Access database on an intranet.

I'm asking here because I'm wondering if your ADO connection would be used.

Thanks for all your help!

Martin

"Mike S." <do******@nores ponse.com> wrote in message
news:Bs******** *************** @bgtnsc04-news.ops.worldn et.att.net...
One way you could handle this is to create a user form for the Excel sheet
that has the data on it. The form would simply have a command button on it
with the following code attached to its on click event:

Private Sub CommandButton1_ Click()
'declare variables for ado connection and sql command
Dim oCon, strSql

'these variables will store data from excel spreadsheet
Dim strLastName As String, strFirstName As String, strTitle As String

'instantiate the connection object, and specify connection properties
Set oCon = CreateObject("a dodb.connection ")
oCon.provider = "microsoft.jet. oledb.4.0"

'open the connection
'you can use a UNC to a file on a server
'ex: \\myserver\data \employees.mdb"
oCon.Open "C:\temp\employ ees.mdb"

'my spreadsheet data starts on second row. first row contains headers,
so i'm ignoring that
Dim intRow As Integer
intRow = 2

'stop the process as soon as we run out of data in the excel spreadsheet
While Not Sheet1.Cells(in tRow, 1) = ""

'assign values from spreadsheet to our variables
strLastName = Sheet1.Cells(in tRow, 1)
strFirstName = Sheet1.Cells(in tRow, 2)
strTitle = Sheet1.Cells(in tRow, 3)

'construct an insert query using our spreadsheet values
strSql = "insert into employees(lastn ame,firstname,t itle) values('"
& _
strLastName & "','" & strFirstName & "','" & strTitle & "');"

'execute the sql command
oCon.Execute strSql

'advance our counter to the next row number and activate the first
cell
intRow = intRow + 1
Sheet1.Cells(in tRow, 1).Activate
Wend
'close and destroy our ado objects
oCon.Close
Set oCon = Nothing
End Sub

This worked ok in office xp... I think it would work in 2000.

Anyway, I hope this helps.
-Mike

"Martin" <md******@earth link.net> wrote in message
news:Cx******** *******@newsrea d1.news.atl.ear thlink.net...
There is an Access table on the network. 15 users who do not have Access

are
connected to the network. Is there a way for each user to be able to enter

one
or more rows containing 3 or 4 columns to Excel on his machine and then

press a
button or something and append that data to the Access table on the

network? Any
suggestions on what the code would be?

Thank you very much!

Martin


Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2337
by: Kevin | last post by:
Hi I have a table that is imported from excel the records are updated as required by the user my question is Can only the new data entered be appended to the table in access ie if i update the table in the morning and import 10 records when i next update the table i want to import only the new data any help would be welcome
1
5368
by: socasteel21 via AccessMonster.com | last post by:
I have a spreadsheet that has 3 tabs each of the worksheets is setup exactly like a cooresponding table in Access. I created a button that should import each tab to a new table and then append those records in the new table to the cooresponding table. Here is my code for the button: ----(start of...
3
8054
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we incur numerous service problems “Events”. Each morning we have a global conference call where events which occurred within the previous 24 hours are...
8
2780
by: DongningLi | last post by:
At month end, there will be a month-to-date table that should be appended into the Year-to-date one. The MTD table is a lump-sum one, no way to enter into the YTD one entry by one entry. I can append Feb MTD to Jan MTD and make it a YTD table, just don't know how to do it continuously. For example, March, the only thing I can think of is to...
2
2870
by: SePp | last post by:
Hi, I have one dataset which is exported to an external file (excel) My problem is that I want to append the data of two different views to one dataset. (because they have to be displayed in an sheet among each other) Something like: cmd = new OracleDataAdapter("Select * from view1"); cmd.Tablemappings.Add("Table", "Views");
4
7589
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to an excel spreadsheet. There are two tables. One is a list of general contacts, and the other is a list of clubs. The clubs contain members who...
10
6745
by: MeeMee | last post by:
Hi I have a problem appending data into an oracle table from access. I imported the new data from an excel sheet into a table in access and useed an append query to add the data into a linked oracle table. The linked table has a composit primary key (Code, Org). The table in access has new data that are not in the oracle table and the data in...
2
6246
by: AccessHunter | last post by:
Please advice me on this. I need to create a new access database that will used to collect the employee hours from various locations. Every friday supervisors from various locations will be sending a spreadsheet that has the following fields;Agency ID,Name,In Date,Out Date, Feb1 week,Feb2 week..until Jun5 week.Data from these spreadsheets needs...
24
6303
by: MNNovice | last post by:
I am working on a DB to record expenses related to various grants. To record Payroll expenses I created tblPayroll with these fields: PayrollID – auto / PK ECHOID – Number FK (tied to tblECHO) PayrollNo – Text PayrollDt – Date/ Time AccountID – Number FK (tied to tblAccounts) FundID – Number FK (tied to tblGrantFunds) OrgID – Number FK...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.