Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2007, 04:35 AM
Authorized User
 
Join Date: Jun 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rob,

Ok, back on the trail from the original threads in this topic.

You showed me the SyncControlsToRS example. Well I have had a go myself, tried to build it normally into the existing code, I ended up with a funny error message that just dont understand, but then thought well I'll try it the way you had said and I get the same error message. Dont understand the error message firstly.

"Item cant be found in the collection corresponding to the requested name or ordinal"

What does that mean?

Public Sub QuestionsRSControls()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
txt.QuestionNo.Value = rs.Fields("Question")
txt.QuestionNoText.Value = rs.Fields("QuestionText")
Set rs = Nothing
End Sub

In this code above I think I was trying to assign the field Questions to the Unbound TextBox (txtQuestionNo) on my form. Have I gone a miss somewhere?

Jez


 
Old July 17th, 2007, 03:47 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Jez,

Hello again! =)

Ok the error message means (in English lol)
"I cant find what your looking for with that name or index number"

Now, the "Collections" you are trying to access is the "Fields" collection, this is the columns
within the Recordset.

Check that the field names you have given exist within the Recordset. You need to use the field
names in the SELECT statement of your SQL.

e.g.
"SELECT MyTable.MyField FROM MyTable" can be used to produce a Recordset. To access the Field Value, you need:
Code:
rs.Fields("MyField")
- See how the field names match?

I hope this helps.

Kind Regards,
Rob

<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Recordsets voskoue Access VBA 1 January 23rd, 2007 08:36 AM
Assigning Recordsets mrjeret BOOK: Access 2003 VBA Programmer's Reference 0 July 6th, 2006 09:39 AM
Cloned Recordsets taraj Access VBA 4 June 13th, 2006 08:28 AM
Need help with recordsets chacquard Access VBA 5 June 21st, 2004 11:58 PM
Recordsets bph Access VBA 17 February 17th, 2004 03:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.