UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Error Message    
 
   
SCOTTEADIE
post May 18 2005, 06:52 AM
Post #1

UtterAccess Addict
Posts: 132
From: Lanarkshire, Scotland



Hi
can any one help with this code, when i try and run it i get an error message

Compile Error - Method or data member not found

i have "borrowed" this code from Northwind sample database to autofill in check boxes
and i cannot get it to work - it keeps coming up with the error on line - rs.Edit
why is this??

thanks for any help

The Code Is:

CODE
Private Sub Form_Close()
    ' clear all checkboxes
    
    Dim db As Database
    Dim rs As Recordset
    
On Error GoTo HandleErr

    Set db = CurrentDb
    Set rs = db.OpenRecordset("select PrintFlag from tblContacts", _
      dbOpenDynaset)
    If rs.RecordCount > 0 Then
        Do Until rs.EOF
        rs.Edit
                rs!PrintFlag = False
            rs.Update
            rs.MoveNext
        Loop
        Me!PrintLabelsSub!ckSelect = False
        Me!PrintLabelsSub!lblSelect.Caption = "Select All tblContacts"
    End If
Go to the top of the page
 
+
MicroE
post May 18 2005, 07:20 AM
Post #2

UtterAccess VIP
Posts: 4,034
From: NY - USA



Make sure to add the Microsoft DAO library to your references.

Also change you DIM statements to:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Go to the top of the page
 
+
dannyseager
post May 18 2005, 07:51 AM
Post #3

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



Also I think that if you have DAO and ADO checked the DAO will need to be above ADO... but that might only be if you've not declared your recordset type as suggested by Matt.
Go to the top of the page
 
+
SCOTTEADIE
post May 18 2005, 08:57 AM
Post #4

UtterAccess Addict
Posts: 132
From: Lanarkshire, Scotland



Thank You Danny & Matt

thanks guys
works a treat now

Best regards
Scott
Go to the top of the page
 
+
dannyseager
post May 18 2005, 10:39 AM
Post #5

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



glad to help
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 12:48 PM