last day (15 days later) » 

10:27 PM
arsarc, invite to chat
I have never tried SO chat before
hope it works
 
ok
 
Hey
 
hi
 
Sorry to seem rude, well not sorry, but there it is
figured i could learn better here
So you have many different tables?
 
Yes, the problem is the company has cellphones for 3 different phone carriers
att (which has 3 different accounts) then verizon then sprint
 
10:31 PM
'"Select [" & NumberName & "],,,,'
 
and each have their own csv
you think it's better to combine them all to one table?
 
from [" & TableName & "]
So you have separate CSVs, I see. Then you are comparing them with your native tables, ft?
And there is a nativce table for each CSV?
 
well each month, we add the csv to the table
 
One thing: you have these deadly huge text strings to fill in the dlookup. One thing this does it makes it hard to trouble shoot.
On the native=-table side:
... the CSVs are all rigid consistant format, I gather? Hooray
 
Basically, it's saying "Look up the PhoneCompany from the Access table where the Phone Number = CSV's Phone Number" and see if the Phone Company is still the same or different
yeah
csv are consistent
 
10:34 PM
So you want one table where they are appended. And the table needs some extra fields so you can track the date of import, which cell-phone company.
Then you only need one recordset on the native side, which stays open; and you filter by what the CSV says.
Does that make sense?
 
So just one table in the access db?
 
Yes. But suppose I lay off the big advice and focus on your problem.
You have to find out why 'ATT' fails to match.
 
yes, it worked when comparing 2 tables
but not 1 table and 1 csv
 
Dim strCriteria as String

strCriteria = "[Number]='" & rs.Fields("[" & NumberName & "]") & _
"' and [Number] is not null"

If DLookup("[PhoneCompany]", "[tblPhoneDept]", strCriteria) Then...
If you put the criteria into a string variable there are some huge advantages.
It becomes portable; you can test it easier.
Hey I just noticed...
 
Oh for the sql part
I get it
ok I guess it's easier to edit that way
 
10:39 PM
About that criteria I just pasted
if you are making [Number] equal something, do you need it also to be not null? Is that not tested?
(maybe you do need it)
 
for instance, the CSV has late payments on the phone bill, which don't have phone numbers
so I don't want to worry about the Phone companies for those
 
Another issue is that DLookup is sort of a black box. You can actually just compare values line by line... VBA with recordsets is so flexible.
 
DAO?
I've only really learned this way, if there's a better way with DAO I'd give it a try
 
Yes, don't use ADO (that is the general firm rule)
 
Ok
 
10:42 PM
You are using DAO already
 
yes but instead of DLookup?
or to replace Dlookup
 
Ha, that's the thing. You use DLooup as a rule when you don;t want to bother with recordsets. Having initiated recordsets, dlookup becomes the wrong tool.
It like using a can opener and a welding torch to get to your Dinty Moore stew.
 
So I should create a 2nd recordset
and select the phone company directly
?
would that be better?
oh I can reset it each time
 
i thnk so. However, I'm not sure there's enough info provided. Some guys on SO are incredible good at sorting it all out, but the code you pasted is beyond me and maybe beyond them.
 
Sorry
 
10:46 PM
Typcially you will initiate both recordesets without focus on filtering, then run Find or filter for each line.
Well I feel bad for chewing on you so hard. But also kind of, hmm, triggered or something
 
i might need to read up a little better on DAO because I just learned how to cycle through records with it but this gives me a better approach
or a different one
 
Is this an ezxisiting project, or dev from scratch?
 
existing
existing
I'll go work on it for now, maybe I can come up with something
thank you
 
Okay
I'll delete my negative comment, ha ha
Good luck and keep working the question.
 

last day (15 days later) »