I continue to pester, I know 
Author Message
 I continue to pester, I know

If one has a recordset, and one wants to refer to a field, one can do the
following:

rs!FieldName

Well, I can't.  The recordset was based upon a query def, and is a snapshot
type.  Changing type did not help
.
Here's the line of code with the error:
prpsDO.Item("Name").Value = Nz(rsClientDO!ClientName)
"Error No. 3265, Item not found in this collection"

NowI refer now to the field  want with the number like this:
   prpsRecDis.Item("City").Value = Nz(rsClientDO.Fields(5))

This works, but is quite annoying.  I want to refer to the recordset based
upon its name!!



Fri, 04 May 2001 03:00:00 GMT  
 I continue to pester, I know
2 ideas:

1.  Are you sure it's not the expression on the _left_ side of the
expression that is giving you trouble?  The fact that you are using
"Name", a reserved word, could be causing the problem.  Test the same
"left side" with a working "right side" to find out.

2.  Perhaps you've not properly typed the name of the field as it is in
the query, or you've got a misleading caption problem.  Try aliasing the
field in the query and using the alias in your code.

If none of this helps, post your query's SQL.

Keri Hardwick

Quote:

> If one has a recordset, and one wants to refer to a field, one can do the
> following:

> rs!FieldName

> Well, I can't.  The recordset was based upon a query def, and is a snapshot
> type.  Changing type did not help
> .
> Here's the line of code with the error:
> prpsDO.Item("Name").Value = Nz(rsClientDO!ClientName)
> "Error No. 3265, Item not found in this collection"

> NowI refer now to the field  want with the number like this:
>    prpsRecDis.Item("City").Value = Nz(rsClientDO.Fields(5))

> This works, but is quite annoying.  I want to refer to the recordset based
> upon its name!!



Sat, 05 May 2001 03:00:00 GMT  
 I continue to pester, I know
Try breaking at the line and in the debug window put

?rsClientDO.Fields(5).Name

You should get
ClientName

back, whatever you do get then try

?rsClientDO.Fields("what you got above").Value

and try
?rsClientDO![what you got above].Value

note the use of the square brackets is only mandatory if you have a space in
the name.

If your getting a result (i.e. no error) then the problem is that you either
selt the name wrong in code, or it's the left hand side of your expression
which is wrong.

and you can test that easily enough with
?prpsDO.Item("Name").Value

in the debug window.

Quote:

>If one has a recordset, and one wants to refer to a field, one can do the
>following:

>rs!FieldName

>Well, I can't.  The recordset was based upon a query def, and is a snapshot
>type.  Changing type did not help
>.
>Here's the line of code with the error:
>prpsDO.Item("Name").Value = Nz(rsClientDO!ClientName)
>"Error No. 3265, Item not found in this collection"

>NowI refer now to the field  want with the number like this:
>   prpsRecDis.Item("City").Value = Nz(rsClientDO.Fields(5))

>This works, but is quite annoying.  I want to refer to the recordset based
>upon its name!!



Sun, 06 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Setup cannot continue...Setup cannot continue...

2. A pestering Run-time error

3. "Continued From" and "Continued On" with long tables

4. I know you know it...

5. msaccess.exe continues running,,,

6. Question about Allen's code...continue...

7. Continuing a line of code on the next line

8. Continuing process after opening a form.

9. Help OLE Insert (Continue)

10. (Q)File Save As Common Dialog *continued* (Ken-Help)

11. access macro to continue running in excel

12. continuing in a for loop

 

 
Powered by phpBB® Forum Software