Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
PRIMARY KEYS
Works now, must be a constant....
checkit = RTrim(rs.fields("ERCOT_UNIT_ID")) & "_" & RTrim(rs.fields ("timestamp")) & "_" & RTrim(rs.fields("SETTLEMENT")) & "_" & nameofbook spcs = 150 - Len(checkit) checkit = "PRIMARY_KEY='" & checkit & "" & Space(spcs) & "'" rg.movefirst rg.Find checkit "Brent" wrote: I am trying to search a database for a primary key, and if it exists then I will not upload the current file. I tried the code below, but it does not seem to work, I think because of what I am trying to find. I notice that if I do not include a check the program finds a duplicate primary key almost instantly, what can I do to make the search as fast as possible? Thank you. checkit = RTrim(rs.fields("ERCOT_UNIT_ID")) & "_" & RTrim(rs.fields _ ("timestamp")) & "_" & RTrim(rs.fields("SETTLEMENT")) & "_" & nameofbook spcs = 150 - Len(checkit) checkit = checkit & "" & Space(spcs) rg.movefirst rg.Find rg.fields("PRIMARY_KEY") = checkit PRIMARY_KEY is a char(150), so it has blank spaces for wha is not used, hence the addition of spaces. But at rg.Find I keep getting error "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another" Run-time error '3001'. Any suggestions?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sort worksheet on multiple keys - Primary, secondary, tirterary, etc. | New Users to Excel | |||
Generating a primary key | Excel Discussion (Misc queries) | |||
(Primary) Key Column? | Excel Discussion (Misc queries) | |||
Check for Primary Key | Excel Programming | |||
How to use Alt keys + symbol keys to invoke a macro? | Excel Programming |