A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Declaring variables - basic question



 
 
Thread Tools Display Modes
  #1  
Old March 2nd, 2006, 11:11 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Declaring variables - basic question

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


  #2  
Old March 2nd, 2006, 11:15 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Declaring variables - basic question

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.

--
Brendan Reynolds
Access MVP


"Will" wrote in message
...
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




  #3  
Old March 2nd, 2006, 02:27 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Declaring variables - basic question


"Brendan Reynolds" wrote in message
...
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.

--
Brendan Reynolds
Access MVP


"Will" wrote in message
...
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




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.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic Question for Lookups. Bernard Piette Database Design 9 December 19th, 2005 12:32 AM
Basic INDEX(MATCH()) Question: Adam Kroger General Discussion 6 December 17th, 2005 04:30 AM
Very basic IF question Veli Izzet General Discussion 2 December 16th, 2005 07:52 PM
Very basic "How To Save a Database" question. ***Accesss 2002 Lou New Users 2 January 29th, 2005 12:26 AM
basic question!!! sylvain Worksheet Functions 5 October 9th, 2003 06:19 AM


All times are GMT +1. The time now is 09:00 PM.


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