Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Understanding syntax

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cinnie - 16 Jan 2008 02:00 GMT
hello to all

By studying examples in this forum, I'm slowly getting better at
programming.  When I see a line like the one shown below, exactly what does
the (0) mean?  When I look up OpenRecordset in VBA help, I don't see any
arguments following the first set of brackets.

strRank = CurrentDb.OpenRecordset(strSQL)(0)

thanks
cinnie
Signature

cinnie

Tom van Stiphout - 16 Jan 2008 03:35 GMT
Don't look at OpenRecordset, but at Recordset Object. That's what
"CurrentDb.OpenRecordset(strSQL)" returns.
Then you can take the 0-est element of that recordset (the first field
in the first record), and assign it to a string value.

More long-winded this could be rewritten as:
dim rs as recordset
set rs = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
if rs.recordcount > 0 then
 'Recordset pointer is at first record.
 strRank = rs.Fields("SomeFieldName").Value

-Tom.

>hello to all
>
[quoted text clipped - 7 lines]
>thanks
>cinnie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.