Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help... Deadline (ADO recordset.filter)


Hey everyone, thanks for your help, im in a bind and need a littl
help... I am trying to search a database with excel and find out if
record is blank with recordset.filter... here is my code..


Code
-------------------
rstTemp.Filter = "CityDataID=' " & strFilter & "' And Year=' ""' And Month=' ""'
-------------------


Pretty much i want it to find a primary key (CityDataID) and if it doe
find it see if the recors for Year and Month are blank. I cant seem t
get this code to work... Any ideas? I would be very grateful

Thanks

--
greenfalco
-----------------------------------------------------------------------
greenfalcon's Profile: http://www.excelforum.com/member.php...fo&userid=1362
View this thread: http://www.excelforum.com/showthread.php?threadid=56034

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Please help... Deadline (ADO recordset.filter)

Not sure how to do it with a filter like that, but using traditional SQL
with a recordset object:

--------------------------

Dim string_variable as String
Dim No_CityDataID as Boolean
Dim No_Month as Boolean
Dim No_Year as Boolean
Dim Duplicate_Key as Boolean

' Dim and Define your recordset/connection here

rstTemp.Source = "SELECT * FROM [YourTableName] WHERE CityDataID = '" +
string_variable + "'"

rst.Open

If rstTemp.EOF Then
No_CityDataID = True
Goto SkipMe ' Without the Goto you will get an
error on the move next...
ElseIf rstTemp!Year = "" Then ' or Null, depending how how the database
handles empty data
No_Year = True
ElseIf rstTemp!Month = "" Then
No_Month = True
End If

rstTemp.MoveNext

'Optional Primary Key Check
If Not rst.EOF
Duplicate_Key = True
End If

SkipMe:
rstTemp.Close

-------------------------------------------

Substitue the Boolean variables with what you want to do when those
situations occur, and make sure to change [YourTableName] to whatever the
table's name is in the database.

David

"greenfalcon"
wrote in message
...

Hey everyone, thanks for your help, im in a bind and need a little
help... I am trying to search a database with excel and find out if a
record is blank with recordset.filter... here is my code..


Code:
--------------------
rstTemp.Filter = "CityDataID=' " & strFilter & "' And Year='
""' And Month=' ""'"
--------------------


Pretty much i want it to find a primary key (CityDataID) and if it does
find it see if the recors for Year and Month are blank. I cant seem to
get this code to work... Any ideas? I would be very grateful

Thanks!


--
greenfalcon
------------------------------------------------------------------------
greenfalcon's Profile:
http://www.excelforum.com/member.php...o&userid=13622
View this thread: http://www.excelforum.com/showthread...hreadid=560347



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Please help... Deadline (ADO recordset.filter)

You seem to have extra spaces in a few places (substituted below with *)

rstTemp.Filter = "CityDataID='*" & strFilter & "' And Year='*""' And Month='*""'"


Tim
--
Tim Williams
Palo Alto, CA


"greenfalcon" wrote in message
...

Hey everyone, thanks for your help, im in a bind and need a little
help... I am trying to search a database with excel and find out if a
record is blank with recordset.filter... here is my code..


Code:
--------------------
rstTemp.Filter = "CityDataID=' " & strFilter & "' And Year=' ""' And Month=' ""'"
--------------------


Pretty much i want it to find a primary key (CityDataID) and if it does
find it see if the recors for Year and Month are blank. I cant seem to
get this code to work... Any ideas? I would be very grateful

Thanks!


--
greenfalcon
------------------------------------------------------------------------
greenfalcon's Profile: http://www.excelforum.com/member.php...o&userid=13622
View this thread: http://www.excelforum.com/showthread...hreadid=560347



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help...I am at work and have a 3pm PST deadline... conditional format if cell contains word[_2_] Excel Discussion (Misc queries) 10 May 28th 09 07:44 PM
ADO Recordset.Filter in Excel 2002 Dash[_2_] Excel Programming 4 January 11th 06 09:13 PM
Active Deadline Willamina Excel Discussion (Misc queries) 5 April 9th 05 07:42 AM
Recordset Filter by Array Kou Vang[_2_] Excel Programming 0 February 1st 05 04:31 PM
missing deadline MJOHNSON Excel Worksheet Functions 3 January 26th 05 11:05 PM


All times are GMT +1. The time now is 10:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"