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?? |
All times are GMT +1. The time now is 12:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com