Item not found in collection Error 3265

G

Guest

can someone help me (newbie) out (using a2k), am seeing this error when i try
to run:

Private Sub cboStudy__AfterUpdate()
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.RecordsetClone.FindFirst "[Study#] = '" & Me![cboStudy#] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
' MsgBox "My Form contains" & Forms![Screening
Log].RecordsetClone.RecordCount _
& " records.", vbInformation, "Record Count"
MsgBox Me.RecordsetClone!Reg# <--- generating "Item not found in
collection" error
' cboReg# = Me.RecordsetClone.Reg#
End Sub

i guess it's complaining that it can't for some reason understand what
"Reg#" is but it is the field name in the table underlying this form. isn't
that what i'm supposed to put here.
 
R

RoyVidar

Ted wrote in message
can someone help me (newbie) out (using a2k), am seeing this error when i try
to run:

Private Sub cboStudy__AfterUpdate()
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.RecordsetClone.FindFirst "[Study#] = '" & Me![cboStudy#] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
' MsgBox "My Form contains" & Forms![Screening
Log].RecordsetClone.RecordCount _
& " records.", vbInformation, "Record Count"
MsgBox Me.RecordsetClone!Reg# <--- generating "Item not found in
collection" error
' cboReg# = Me.RecordsetClone.Reg#
End Sub

i guess it's complaining that it can't for some reason understand what
"Reg#" is but it is the field name in the table underlying this form. isn't
that what i'm supposed to put here.

Be carefull with special characters. Eh - no - don't use them at all
;-)

Perhaps this will work?

MsgBox Me.RecordsetClone![Reg#]

The workaround for such "bad habits", is using brackets, which will
work
some of the times - but next time you name objects, you avoid spaces
and
special characters, eh ;-)
 
D

Dirk Goldgar

Ted said:
can someone help me (newbie) out (using a2k), am seeing this error
when i try to run:

Private Sub cboStudy__AfterUpdate()
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.RecordsetClone.FindFirst "[Study#] = '" & Me![cboStudy#] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
' MsgBox "My Form contains" & Forms![Screening
Log].RecordsetClone.RecordCount _
& " records.", vbInformation, "Record Count"
MsgBox Me.RecordsetClone!Reg# <--- generating "Item not found in
collection" error
' cboReg# = Me.RecordsetClone.Reg#
End Sub

i guess it's complaining that it can't for some reason understand what
"Reg#" is but it is the field name in the table underlying this form.
isn't that what i'm supposed to put here.

First you need to enclose the name "Reg#" in square brackets, as the "#"
character isn't normally valid in a field or control name, and must be
quoted in that fashion:

MsgBox Me.RecordsetClone![Reg#]
' Me![cboReg#] = Me.RecordsetClone![Reg#]

If that's not enough to correct the problem, check the form's
RecordSource property to see if the form is based on a query of the
table, and if so, make sure that query includes the field [Reg#] in the
list of fields it returns.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top