LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Where Clause Errors

I have a worksheet which houses changing data rows. To Update this
data I use a UserForm for staff to make appropriate changes, then run
a macro which update an Access Database using Select Clause, From,
Where.

As the database has numberous records from many staff menbers I need
the Where Clause to search for two variables. The code sets up the
variables without problem, but the Where clause is in error and no
records are selected. Here is my code:

LG = Range("G" & 1).Value 'The Staff ID
Qry = "LOG" & LG

For R = 4 To 300
ColB = Worksheets("Contacts").Cells(R, 2).Value
If ColB = "E" Then Exit For ' Marked for editing
Next R

SSN = Range("G" & R).Value 'Rows unique identifier- Claimants SSN
adjlog = "\\xxxx.mdb"
Set dbs = OpenDatabase(adjlog)
Set qd = dbs.CreateQueryDef(Qry)
qd.SQL = "SELECT * FROM TEntry " _
& "WHERE [Login] = 'LG' AND [SSN] ='SSN';"
Set rs = dbs.OpenRecordset(Qry)

Fails here as rs = Nothing.

This is the final part of this new code to impliment the Worksheet,
Appreciate any help.
 
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
PERCENTILE with an IF Clause Zeelotes Excel Worksheet Functions 3 April 19th 23 02:11 PM
IF clause for a range of cells Al Excel Worksheet Functions 3 January 18th 10 01:42 PM
$ sign in SQL clause in MS Query FredAker Excel Discussion (Misc queries) 1 July 30th 08 10:43 AM
IF Clause dpal Excel Worksheet Functions 8 July 19th 07 07:32 PM
"Between" in an IF clause gavin Excel Discussion (Misc queries) 5 May 2nd 05 09:27 PM


All times are GMT +1. The time now is 06:21 AM.

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

About Us

"It's about Microsoft Excel"