Results 1 to 6 of 6
  1. #1
    Vronsky is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2011
    Posts
    12

    Object does not support this method or property

    I have a little code on the 'Current' event of a form. It examines certain fields in the current record in order to update some text fields on the form. It all works fine, except that the code refuses to handle one field (an integer), giving the message 'Object does not support this method or property'. I can display the value of all the other fields in the debug window, but this one throws that error no matter what I try to do. The field is called 'Interests' which so far as I can determine is not an Access keyword.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Hi

    Can you post the code?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Vronsky is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2011
    Posts
    12

    Code

    Private Sub Form_Current()

    Dim MaskInterests As Integer
    Dim i As Integer

    ' The [interests] field is a bitmask for the interests of the current volunteer
    ' see which interests he/she has by logical AND

    ' set selections for current volunteer
    MaskInterests = Nz([Interests], 0) ' this line throws error
    For i = 0 To lstInterests.ListCount - 1
    If (MaskInterests And 2 ^ i) <> 0 Then
    lstInterests.Selected(i) = True
    End If
    Next

    End Sub

  4. #4
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Hi,

    Check if your listbox "lstInterests" Multi Select is set to Extended?

    There is no problem with:
    lstInterests.Selected(i) = True

  5. #5
    Vronsky is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2011
    Posts
    12

    List

    No. it's set to 'Simple'. If I create a new form and insert this code it works without a problem. Could it be a corrupt form? How can I check that?

  6. #6
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    I was thinking that this line of code has null values
    MaskInterests = Nz([Interests], 0)

    but you already use Nz function to recover the null bugs, It happens with the corrupt form sometime and you need to compile your code with Debug >>> Compile, also the db should be compact and repair time to time to overcome such un-known errors.

    Glad that your code is working now

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Object doesn't support property or method
    By Jamy in forum Programming
    Replies: 7
    Last Post: 07-15-2013, 01:42 AM
  2. Replies: 7
    Last Post: 02-03-2011, 07:13 AM
  3. object or class does not support the set of events
    By couch potato in forum Programming
    Replies: 2
    Last Post: 03-20-2010, 08:55 AM
  4. Replies: 5
    Last Post: 08-05-2009, 04:07 PM
  5. Replies: 2
    Last Post: 02-28-2009, 03:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums