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 / New Users / March 2006

Tip: Looking for answers? Try searching our database.

Declaring variables - basic question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Will - 02 Mar 2006 11:11 GMT
I have found a number of instances in the database I have inherited where
variables have been declared  "Dim rs, rh, Dt As Recordset".  Does this mean
that rs, rh and Dt are all declared as recordsets or has the previous
programmer misunderstood and rs, rh are actually variants and dt is a
recordset?

Thanks in advance
Brendan Reynolds - 02 Mar 2006 11:15 GMT
The latter.

In some languages, including VB.NET, you can declare multiple variables in
this way, specifying the type only once at the end of the line, but in
'classic' VB and VBA you need to specify the type of each variable, or, as
you say, Variant will be used by default.

Signature

Brendan Reynolds
Access MVP

>I have found a number of instances in the database I have inherited where
>variables have been declared  "Dim rs, rh, Dt As Recordset".  Does this
[quoted text clipped - 3 lines]
>
> Thanks in advance
Brian Wilson - 02 Mar 2006 14:27 GMT
> The latter.
>
[quoted text clipped - 10 lines]
>>
>> Thanks in advance

To the OP:
And if you are going to correct this mistake, you may as well specify the
object library while you're at it.  In other words, change:
Dim rs As Recordset
to either
Dim rs As DAO.Recordset
or
Dim rs As ADODB.Recordset

depending on which was intended.
 
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



©2008 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.