Error: Object doesn't support property or method

nharrison

Registered User.
Local time
Today, 15:19
Joined
Jun 11, 2009
Messages
55
Hi all, I am trying to basically set the value of an option box through simple VBA, and I just can't get it to work, I receive Run-time error '438': Object doesn't support property or method. Here's the code:

Code:
Public Sub ProjectViewCmd(ID As Long, Stat As String)
    Dim i As Integer
    Dim MyBox As String
    
    'if it is a project lead
    If Stat = "Active Lead" Or Stat = "Dead Lead" Then
        DoCmd.OpenForm "Project Leads", acNormal
        If Stat = "Dead Lead" Then
            Forms![Project Leads].Controls(BothOption).Value = True
            Forms![Project Leads].FilterOn = False
            Forms![Project Leads].Controls(ActiveOption).Value = False
            Forms![Project Leads].Controls(DeadOption).Value = False
        End If
        DoCmd.SearchForRecord acForm, "Project Leads", acFirst, "[Project ID]=" & ID
        'if it belongs in the project list form (i.e. not a lead)
        Else
            DoCmd.OpenForm "Project List", acNormal
            For i = 0 To 4
                MyBox = "Check" & CStr(i)
                If Forms![Project List].Controls(MyBox).Tag = Stat Then
                    Forms![Project List].Controls(MyBox).Value = True
                End If
            Next i
            ProjectSort
    End If

End Sub

The problem lines are
Forms![Project Leads].Controls(BothOption).Value = True
Forms![Project Leads].FilterOn = False
Forms![Project Leads].Controls(ActiveOption).Value = False
Forms![Project Leads].Controls(DeadOption).Value = False

Basically, depending on the status of a project (Active Lead, Dead Lead, etc) a button needs to open the correct form to view that project. However by default the forms are filtered and have buttons to adjust said filters. When I open the forms, I need to change the filters in order to have the selected project present in the recordset. My issue comes up when trying to simply set the option box back to false
 
Quotes around the control name.
Forms![Project Leads].Controls("BothOption").Value = True

(unless of course BothOption is a variable, but I don't see it defined anywhere)

Also Controls is the default collection of Form which is the default property of a form object and Value is the default property of a control so you can write (and most do):
Forms![Project Leads]!BothOption = True
 
You can also try

Forms("Project Leads")("BothOption") = True

David
 
Thanks guys, both of those options fixed the problem, appreciate the help.
 
Hi,
When I try to open an Access 2003 MDB file, I receive the dreaded Error Message 438: Object doesn't support property or method. I've tried installing the Microsoft security updates to fix this with no avail. How can I fix this?
 
Hi,
When I try to open an Access 2003 MDB file, I receive the dreaded Error Message 438: Object doesn't support property or method. I've tried installing the Microsoft security updates to fix this with no avail. How can I fix this?

Can you upload the database so we can see if we can track down the problem? There are quite a few reasons it could be doing this and I'm not sure where to start - I'm more visual, I can spot things better if I can see them and play with it.
 
When I try to click on the link it gives me an error:

Insufficient privileges
 
Glen,
PSReports2000 is a commercial software. What you uploaded looks to be a demo version. Dunno if you are trying to bypass code to turn it into a full blown version...but might I suggest that if you have a legit copy to contact the developers with your issue.
 
PSReports2000 works with ParishSoft software. I contacted technical support after I received the error message. The tech checked out the PS software and found nothing wrong. He thought, since I recently reinstalled Access 2003 onto my computer, maybe it was missing an update. I checked and installed any and all updates. Still received message. I then uninstalled Access and reinstalled the Access and the updates. Still get the message. I have since contacted PS technical support again, but was unable to talk the tech today. Should be able to tomorrow. Seems to bme I had this problem a few years ago with their software after reinstalling it. I think it's a code issue, but I can't remember how they fixed it. The software comes as a demo version until you enter the license information. Thanks to you both for trying to troubleshoot this.
 
Well, after looking at it, it seems that it is looking for a table or query called Inidata. I looked at the tables and queries, and could not find it. It then closes down on me. You might want to bring that up to tech support.
 

Users who are viewing this thread

Back
Top Bottom