A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Append a specific record from excel to my table



 
 
Thread Tools Display Modes
  #1  
Old August 30th, 2009, 05:43 PM posted to microsoft.public.access.gettingstarted
Raymond[_8_]
external usenet poster
 
Posts: 24
Default Append a specific record from excel to my table

I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do this?
Thanks
--
Ray J
Brooksville, Florida

  #2  
Old August 30th, 2009, 07:04 PM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Append a specific record from excel to my table

"Raymond" wrote in message
...
I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do
this?



I'm not sure I completely understand what you have in mind, but if I do,
this is how I would go about it:

1. Link to the Excel worksheet, so that it is available to your database as
a linked table.

2. Have a form with a combo box whose rowsource is a query that returns the
search field from the linked Excel table.

3. In the AfterUpdate event of that combo box, or else in a command button
on that form to be clicked after the user has made a selection in the combo
box, execute an append query that selects the record from the linked table
that matches the combo box value, and appends it (or the appropriate fields
from it) to the target table.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #3  
Old August 30th, 2009, 07:09 PM posted to microsoft.public.access.gettingstarted
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Append a specific record from excel to my table

Rather that a myriad of VBA code for a simple task, I'd consider an lookup
in Excel, then a copy/paste. If this is something that must be done
frequently, especially by untrained staff, I'd look at the Excel automation
code at Ken Snell's Access/Excel pages:

http://www.accessmvp.com/KDSnell/EXCEL_MainPage.htm
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Raymond" wrote in message
...
I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do
this?
Thanks
--
Ray J
Brooksville, Florida



  #4  
Old August 30th, 2009, 08:08 PM posted to microsoft.public.access.gettingstarted
Raymond[_8_]
external usenet poster
 
Posts: 24
Default Append a specific record from excel to my table

Thanks,
I have a combo box linked to the excel so my user can type and select the
record to append. I also added 3 fields to the form to show the user the
address but when i select the record and tab the fields change to another
record. Why is that?

As far as appending the record to my table I'd like to use a command button
once they are sure they have the correct record, will the wizard help me
there or is there code I need to enter?
Thanks Again
--
Ray J
Brooksville, Florida


"Dirk Goldgar" wrote:

"Raymond" wrote in message
...
I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do
this?



I'm not sure I completely understand what you have in mind, but if I do,
this is how I would go about it:

1. Link to the Excel worksheet, so that it is available to your database as
a linked table.

2. Have a form with a combo box whose rowsource is a query that returns the
search field from the linked Excel table.

3. In the AfterUpdate event of that combo box, or else in a command button
on that form to be clicked after the user has made a selection in the combo
box, execute an append query that selects the record from the linked table
that matches the combo box value, and appends it (or the appropriate fields
from it) to the target table.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #5  
Old August 30th, 2009, 10:47 PM posted to microsoft.public.access.gettingstarted
Raymond[_8_]
external usenet poster
 
Posts: 24
Default Append a specific record from excel to my table

Well I made some headway with your tip but I need some follow up.
I made the append query and added it to a command button. When I enter the
numbers in my combo box and click the command button it will add 16 duplicate
records. The fields and the requested record all match, so thats good. Can't
figure why 16, its not amount of fields I appending. The source data records
are all unique, 1 record per number.
--
Ray J


"Dirk Goldgar" wrote:

"Raymond" wrote in message
...
I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do
this?



I'm not sure I completely understand what you have in mind, but if I do,
this is how I would go about it:

1. Link to the Excel worksheet, so that it is available to your database as
a linked table.

2. Have a form with a combo box whose rowsource is a query that returns the
search field from the linked Excel table.

3. In the AfterUpdate event of that combo box, or else in a command button
on that form to be clicked after the user has made a selection in the combo
box, execute an append query that selects the record from the linked table
that matches the combo box value, and appends it (or the appropriate fields
from it) to the target table.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #6  
Old August 30th, 2009, 11:31 PM posted to microsoft.public.access.gettingstarted
Raymond[_8_]
external usenet poster
 
Posts: 24
Default Append a specific record from excel to my table

its appears it appending as many records as there are in the source table.
I delete some records and the next query wants to add as many records are in
there. Not sure why?

--
Ray J


"Dirk Goldgar" wrote:

"Raymond" wrote in message
...
I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do
this?



I'm not sure I completely understand what you have in mind, but if I do,
this is how I would go about it:

1. Link to the Excel worksheet, so that it is available to your database as
a linked table.

2. Have a form with a combo box whose rowsource is a query that returns the
search field from the linked Excel table.

3. In the AfterUpdate event of that combo box, or else in a command button
on that form to be clicked after the user has made a selection in the combo
box, execute an append query that selects the record from the linked table
that matches the combo box value, and appends it (or the appropriate fields
from it) to the target table.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #7  
Old August 30th, 2009, 11:53 PM posted to microsoft.public.access.gettingstarted
Raymond[_8_]
external usenet poster
 
Posts: 24
Default Append a specific record from excel to my table

The code in my append comm button...
I'll check back monday, thanks again, Ray

Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
Dim stDocName As String
stDocName = "Query3"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command11_Click:
Exit Sub

Err_Command11_Click:
MsgBox Err.Description
Resume Exit_Command11_Click

End Sub

--
Ray J


"Dirk Goldgar" wrote:

"Raymond" wrote in message
...
I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do
this?



I'm not sure I completely understand what you have in mind, but if I do,
this is how I would go about it:

1. Link to the Excel worksheet, so that it is available to your database as
a linked table.

2. Have a form with a combo box whose rowsource is a query that returns the
search field from the linked Excel table.

3. In the AfterUpdate event of that combo box, or else in a command button
on that form to be clicked after the user has made a selection in the combo
box, execute an append query that selects the record from the linked table
that matches the combo box value, and appends it (or the appropriate fields
from it) to the target table.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #8  
Old August 31st, 2009, 12:13 AM posted to microsoft.public.access.gettingstarted
Raymond[_8_]
external usenet poster
 
Posts: 24
Default Append a specific record from excel to my table

I found the err sunday night so thanks. The unique records I changed to yes
in query properties and that seems to be the trick.

I still have not figured why my form fields do not show the record I choose
but thats a job for monday, thanks again...
--
Ray J


"Dirk Goldgar" wrote:

"Raymond" wrote in message
...
I would like to import a single unique record from excel based on a 6 digit
number search and append it to my table. Anyone know the best way to do
this?



I'm not sure I completely understand what you have in mind, but if I do,
this is how I would go about it:

1. Link to the Excel worksheet, so that it is available to your database as
a linked table.

2. Have a form with a combo box whose rowsource is a query that returns the
search field from the linked Excel table.

3. In the AfterUpdate event of that combo box, or else in a command button
on that form to be clicked after the user has made a selection in the combo
box, execute an append query that selects the record from the linked table
that matches the combo box value, and appends it (or the appropriate fields
from it) to the target table.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #9  
Old August 31st, 2009, 01:25 AM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Append a specific record from excel to my table

"Raymond" wrote in message
...
Thanks,
I have a combo box linked to the excel so my user can type and select the
record to append. I also added 3 fields to the form to show the user the
address but when i select the record and tab the fields change to another
record. Why is that?



It's not clear to me what you've done to make the fields show the
information from the selected record. What is the RecordSource property of
the form? what is the Row Source property of the combo box? What are the
Control Source properties of the fields on the form, that you want to show
data from the selected record?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #10  
Old August 31st, 2009, 02:26 AM posted to microsoft.public.access.gettingstarted
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Append a specific record from excel to my table

On Sun, 30 Aug 2009 15:53:01 -0700, Raymond wrote:

The code in my append comm button...
I'll check back monday, thanks again, Ray

Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
Dim stDocName As String
stDocName = "Query3"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command11_Click:
Exit Sub

Err_Command11_Click:
MsgBox Err.Description
Resume Exit_Command11_Click

End Sub


Please post the SQL view of query3. My GUESS is that you're joining the target
table to the source table (hence the multiple records); the append query
should be based on the linked Excel spreadsheet (only), not on it joined to
the table.
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.