From: Hanna on
I am new to Access database. I am using Access 2007 and I am modifying a data
entry program for a 100+ pages survey originally created in a version prior
Access 2003. It requirs entering data twice for accuracy. The survey has
several sections and each section has some forms. The data entry program
starts with a main form to Add a new case or select an existing case to edit.
A click on the EDIT button will bring up the Subject Menu form to select a
section to edit. Then a click on a specific section will bring up the Section
Menu with buttons for all the sub-forms within the section. I have
added/deleted fields to the tables and forms and modified the correcponding
VB codes. Most sub-forms are working fine except two sub-forms.

First one gives me error message as below:

"Run-time error '2424';
The expression you entered has a field, control, or property name that
Survey can't find."

and highlighted the line "If Me.Entry.Value = "1" Then" in the code below:


Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim strSQL As String

Set rs = New ADODB.Recordset
If Me.Entry.Value = "1" Then
strSQL = "SELECT * FROM tblQuestionaireB WHERE KEY='" +
Me.txtSUBJECTID.Value + "2'"
Else
strSQL = "SELECT * FROM tblQuestionaireB WHERE KEY='" +
Me.txtSUBJECTID.Value + "1'"
End If
rs.Open strSQL, CurrentProject.Connection
OtherB5_1mom = rs.Fields("B5_1mom").Value
OtherB5_1momage = rs.Fields("B5_1momage").Value
OtherB5_2mom = rs.Fields("B5_2mom").Value
OtherB5_2momage = rs.Fields("B5_2momage").Value
............. More code

End Sub

The second one gives me the following error message:

"Run-time error '3265';

Item cannot found in the collection corresponding to the requested name or
ordinal."

A Debug gives me the highlighted line
"OtherI5q76m6 = rs.Fields("I5q76m6").Value"
in the code below.

Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim strSQL As String

Set rs = New ADODB.Recordset
If Me.Entry.Value = "1" Then
strSQL = "SELECT * FROM tblQuestionaireI6 WHERE KEY='" +
Me.txtSUBJECTID.Value + "2'"
Else
strSQL = "SELECT * FROM tblQuestionaireI6 WHERE KEY='" +
Me.txtSUBJECTID.Value + "1'"
End If
OtherI5q76m6 = rs.Fields("I5q76m6").Value
OtherI5q77m6 = rs.Fields("I5q77m6").Value
OtherI5q78m6 = rs.Fields("I5q78m6").Value
OtherI5q79m6 = rs.Fields("I5q79m6").Value

........ More code

End Sub

Could anybody help me with this please? Thanks in advance.

Hanna
From: Linq Adams via AccessMonster.com on
Assuming that you have a control named Entry, the first thing I'd do is check
for a missing reference.

Access has a bad habit, in my experience, of highlighting the line
***after*** the line that is causing the problem, so the error may actually
be coming from

Set rs = New ADODB.Recordset

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

From: Hanna on
Thanks, I do have a control named "Entry". I will check more.
Hanna

"Linq Adams via AccessMonster.com" wrote:

> Assuming that you have a control named Entry, the first thing I'd do is check
> for a missing reference.
>
> Access has a bad habit, in my experience, of highlighting the line
> ***after*** the line that is causing the problem, so the error may actually
> be coming from
>
> Set rs = New ADODB.Recordset
>
> --
> There's ALWAYS more than one way to skin a cat!
>
> Answers/posts based on Access 2000/2003
>
> Message posted via http://www.accessmonster.com
>
> .
>
From: Hanna on
Eh...Linq, could you tell me how to check the missing reference please?

"Linq Adams via AccessMonster.com" wrote:

> Assuming that you have a control named Entry, the first thing I'd do is check
> for a missing reference.
>
> Access has a bad habit, in my experience, of highlighting the line
> ***after*** the line that is causing the problem, so the error may actually
> be coming from
>
> Set rs = New ADODB.Recordset
>
> --
> There's ALWAYS more than one way to skin a cat!
>
> Answers/posts based on Access 2000/2003
>
> Message posted via http://www.accessmonster.com
>
> .
>
From: Douglas J. Steele on
While in the VB Editor, select Tools | References from the menu bar. Check
that none of the selected references (the checked ones at the top of the
list) have MISSING: in front of their names.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Hanna" <Hanna(a)discussions.microsoft.com> wrote in message
news:F21ED106-25BE-4597-8F8D-877FE8A56B02(a)microsoft.com...
> Eh...Linq, could you tell me how to check the missing reference please?
>
> "Linq Adams via AccessMonster.com" wrote:
>
>> Assuming that you have a control named Entry, the first thing I'd do is
>> check
>> for a missing reference.
>>
>> Access has a bad habit, in my experience, of highlighting the line
>> ***after*** the line that is causing the problem, so the error may
>> actually
>> be coming from
>>
>> Set rs = New ADODB.Recordset
>>
>> --
>> There's ALWAYS more than one way to skin a cat!
>>
>> Answers/posts based on Access 2000/2003
>>
>> Message posted via http://www.accessmonster.com
>>
>> .
>>