Jurgen Welz
jwelz at hotmail.com
Wed Sep 30 17:46:22 CDT 2009
If your variables are strongly typed, you would be wise to use NZ(rst("FldName"), "") or NZ(rst("FldName"), 0) or whatever makes sense depending on the type. Using the bang is slower than using the index or the field name in quotes. So far I haven't used the Value property and rely on the default property being the value but that will likely change. If the field name is "FldName", it doesn't need to stored in a string variable as suggested by John. If it is stored in a variable, strFldName, then his example would be: MyVar = rst(strFldName).Value without the quotes. Ciao Jürgen Welz Edmonton, Alberta jwelz at hotmail.com > Date: Wed, 30 Sep 2009 07:57:18 -0400 > From: jwcolby at colbyconsulting.com > To: accessd at databaseadvisors.com > Subject: Re: [AccessD] Do While Syntax > > There are several variations. > > MyVar = rst("FldName").value > MyVar = rst!FldName.Value > MyVar - rst(MyIndex).Value > > The first is used if you have the NAME of the field in a string variable. > The second is when you know the field name but do not have it stored in a string variable. > The third is when you are working through the fields using a numeric integer as a field collection > index. > > John W. Colby > www.ColbyConsulting.com _________________________________________________________________ Windows Live helps you keep up with all your friends, in one place. http://go.microsoft.com/?linkid=9660826