Help with run-time error '2424' and '3265'

H

Hanna

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
 
L

Linq Adams via AccessMonster.com

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
 
D

Douglas J. Steele

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.
 

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