Connecting Tech Pros Worldwide Forums | Help | Site Map

How to look for a match for two values in an excel row?

Paul H
Guest
 
Posts: n/a
#1: Sep 26 '06
In my tblOrderDetails table I have the following fields: OrderID,
OrderItemID and DeliveryDate.

I need to loop trough each row in an excel spreadsheet and find OrderID and
OrderItemID combinations that match rows in tblOrderDetails then update the
DeliveryDate field in tblOrderDetails based on the DeliveryDate held in the
corresponding row of the excel spreadsheet.

What is the most efficient way of doing this?

Assume the spreadsheet looks like this:
Column "A" = OrderID
Column "B" = OrderItemID
Column "C" = DeliverDate

Would it be something like (written in layman's terms):

For each row in tblOrderDetails _
get the value of the OrderID an OrderItemID

Then Loop through the Excel spreadsheet _
and check column "A" for an OrderID match
If an OrderID match is found _
check for a match of the OrderItemID

If both values match then
loop through the tblOrderDetails table and update the _
DeliveryDate field for that item

Is that the most efficient way of doing this. I'll worry about the actual
code later, I just want to know if I have got this bit right.

Thanks

Paul




pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Sep 26 '06

re: How to look for a match for two values in an excel row?


Create a link to the SS in your database and use an update query. Wow,
talk about making a simple problem really complicated. Just join your
Excel table to your Access table on the two matching fields.

pietlinden@hotmail.com
Guest
 
Posts: n/a
#3: Sep 26 '06

re: How to look for a match for two values in an excel row?


Create a link to the SS in your database and use an update query. Wow,
talk about making a simple problem really complicated. Just join your
Excel table to your Access table on the two matching fields.

Paul H
Guest
 
Posts: n/a
#4: Sep 26 '06

re: How to look for a match for two values in an excel row?



<pietlinden@hotmail.comwrote in message
news:1159275262.010981.192200@i3g2000cwc.googlegro ups.com...
Quote:
Create a link to the SS in your database and use an update query. Wow,
talk about making a simple problem really complicated. Just join your
Excel table to your Access table on the two matching fields.
>
The trouble is, the Excel spreadsheet contains a load of other garbage
(descriptions of each column and other notes) it's not just data.

:O(

Paul


pietlinden@hotmail.com
Guest
 
Posts: n/a
#5: Sep 26 '06

re: How to look for a match for two values in an excel row?



Paul H wrote:
Quote:
<pietlinden@hotmail.comwrote in message
news:1159275262.010981.192200@i3g2000cwc.googlegro ups.com...
Quote:
Create a link to the SS in your database and use an update query. Wow,
talk about making a simple problem really complicated. Just join your
Excel table to your Access table on the two matching fields.
>
The trouble is, the Excel spreadsheet contains a load of other garbage
(descriptions of each column and other notes) it's not just data.
>
:O(
>
Paul
as long as the table is normalized enough to query,that's irrelevant

Paul H
Guest
 
Posts: n/a
#6: Sep 27 '06

re: How to look for a match for two values in an excel row?



<pietlinden@hotmail.comwrote in message
news:1159286298.095934.30490@i3g2000cwc.googlegrou ps.com...
Quote:
>
Paul H wrote:
Quote:
><pietlinden@hotmail.comwrote in message
>news:1159275262.010981.192200@i3g2000cwc.googlegr oups.com...
Quote:
Create a link to the SS in your database and use an update query. Wow,
talk about making a simple problem really complicated. Just join your
Excel table to your Access table on the two matching fields.
>
>>
>The trouble is, the Excel spreadsheet contains a load of other garbage
>(descriptions of each column and other notes) it's not just data.
>>
>:O(
>>
>Paul
>
as long as the table is normalized enough to query,that's irrelevant
>
Thanks again for your reply..

I tried this and it worked. I am now stuck with the problem described here:

http://www.kbalertz.com/162539/Appea...readsheet.aspx

So I am now using DoCmd.TransferSpreadsheet to get all the SS data into
Access where I can build the queries you initially suggested.

The customer does not want to have to tinker with the spreadsheets each time
he does the import. He just wants a big red "Import" button to do all the
work. I guess I could use VBA to create a copy of the SS and strip all the
crap out of that, but there are too many variables regarding the level and
amount of crap in each SS to make that a better solution than
TransferSpreadsheet.....I think!

:O/

Paul


Closed Thread


Similar Microsoft Access / VBA bytes