Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method or Data Member Not Found

Status
Not open for further replies.

jamez05

Programmer
Jul 29, 2005
130
US
I'm using Access 2003. I'm get the compile error "Method or Data Member Not Found" when trying to loop through some embedded sql. I've done this a million times before so I'm not sure why the error is happening in this case.

Here's the sql statement:
Code:
strSQL = "SELECT d.Rec_ID, d.[Site ID] FROM tblStat"
Here where the error's happenning, when I try to msgbox the [site id]:
Code:
Set rs = CurrentDb.OpenRecordset(strSQL)
  TotalRecords = 1
   If rs.BOF = True And rs.EOF = True Then
       TotalRecords = 0
   End If
      
   If TotalRecords <> 0 Then
       rs.MoveFirst
        Do Until rs.EOF
            MsgBox rs.[Site ID]
            rs.MoveNext
        Loop
   End If

I can't see anything wrong. The only possible thing may have to do with selecting the Rec_ID in the query because its an autonumber and index, but can't figure out why that would matter?
 
Doesn't look like the d. is an alias for anything here.
Try
Code:
strSQL = "SELECT Rec_ID, Site ID FROM tblStat"

It's always darkest before dawn. So if you're going to steal your
neighbor's newspaper, that's the time to do it.
 
What about replacing this
MsgBox rs.[Site ID]
with this ?
MsgBox rs![Site ID]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Nice catch PHV.....

It's always darkest before dawn. So if you're going to steal your
neighbor's newspaper, that's the time to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top