Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
rs.find or rs.filter
trying to use rg.find as shown below:
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 = "PRIMARY_KEY=" & checkit I know the error is on the rg.Find line and is a result of the variable checkit. Checkit is a string and Primary_Key is in the database as a char of 150 characters, hence the addition of blank spaces to checkit. How do I get around this error? It seems you cannot use variables with the Find method? Thank you. Brent |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
rs.find or rs.filter
Brent,
I assume rg is an ADO recordset object. try: rg.Filter = "PRIMARY_KEY='" & checkit & "'" Notice I added the single quote characters to enclose the checkit value. Also, unless the values in PRIMARY_KEY column are right padded with spaces, you won't need to pad checkit with spaces. you can also try: rg.Filter = "TRIM(PRIMARY_KEY)=TRIM('" & checkit & "')" but I think that would depend on the database you're connecting to. -- Hope that helps. Vergel Adriano "Brent" wrote: trying to use rg.find as shown below: 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 = "PRIMARY_KEY=" & checkit I know the error is on the rg.Find line and is a result of the variable checkit. Checkit is a string and Primary_Key is in the database as a char of 150 characters, hence the addition of blank spaces to checkit. How do I get around this error? It seems you cannot use variables with the Find method? Thank you. Brent |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find blank with Advanced Filter | Excel Discussion (Misc queries) | |||
Cannot find info entered when I use filter. HELP! | Excel Discussion (Misc queries) | |||
Find, Filter and Paste Duplicates | Excel Discussion (Misc queries) | |||
formula to find the filter criteria | Excel Worksheet Functions | |||
"find" and "filter" working weirdly | Excel Discussion (Misc queries) |