Primary key search

B

Brent

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.

rsg.Find RTrim(rs.fields("ERCOT_UNIT_ID")) & "_" &
RTrim(rs.fields("timestamp")) & "_" & RTrim(rs.fields("SETTLEMENT")) & "_" &
nameofbook

Brent
 
B

Brent

Now trying this:

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??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

PRIMARY KEYS 1
rs.find or rs.filter 1
Application Error 0
VBA word change keys 0
Error, don't know why 0
App. Error Excel 2003 0
Return Primary Key 1
Help with run-time error '2424' and '3265' 4

Top