Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Posts
    15

    Unanswered: run time error 438, object doesnt support this property

    I have tried changing this vba code any which way and cant get error messages to disappear. I am trying to lock old records and unlock for new forms. I have done this for one form field but cant get this peice of code to work. The field I am working with is a combo box. Thanks

    Private Sub Form_Open(Cancel As Integer)
    Dim ContainerForm As Form
    If Nz(Form.Containertype) = 0 Then
    Form.Containertype.Locked = False
    Else
    Form.Containertype.Locked = True
    End If
    End Sub

  2. #2
    Join Date
    Jan 2010
    Posts
    15
    Okay I fixed that by changing the names of the fields into container all over the place to make that work, but now I can't get it to unlock from locked. What should I have in the place where the 0 is to check the field if it is a text. I tried null and that didnt work

  3. #3
    Join Date
    Jan 2010
    Posts
    15
    K, I know my problem, I fixed all the code and forms and I ran it on sub Form_current and it worked but I already have the same lock unlock happening on current, so I need this container to lock on another like Form_open event or on_click but neither seem to work correctly, any suggestions?
    Please help

  4. #4
    Join Date
    Jan 2010
    Posts
    15
    K, I know my problem, I fixed all the code and forms and I ran it on sub Form_current and it worked but I already have the same lock unlock happening on current, so I need this container to lock on another like Form_open event or on_click but neither seem to work correctly, any suggestions?
    Please help

  5. #5
    Join Date
    May 2009
    Location
    India
    Posts
    66
    ]I think the problem lies with

    Code:
    If Nz(Form.Containertype) = 0
    because it seems to me that the condition is always failing and so executing the else part.

    A way to check it out would be to swap the conditions thus.
    Code:
    If Nz(Form.Containertype) = 0 Then
    Form.Containertype.Locked = True
    Else
    Form.Containertype.Locked = False
    End If
    or maybe simply:
    With NZ

    End

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •