Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Help with runtime error 2448 you can't assign a value to this object

  1. #1
    New Member
    Join Date
    Oct 2007
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Help with runtime error 2448 you can't assign a value to this object

    Hi folks

    Please can someone tell me where I am going wrong to get this error?

    I have a main form (frmsearch) which has controls on it that are used to search the records in the subform (frmentries). The subform runs off a query which looks to frmsearch to get the criteria. The controls on frmsearch are a combination of text boxes and combo boxes, and date fields which can be filled in using a calendar contol.

    There are two command buttons, one to execute the search, and another to clear all search fields to start again. It's in the clear search command that I get the error.

    This is the on click event, the debugger highlights "ctl.value = null":

    Private Sub cmdclearsearch_Click()
    For Each ctl In Me.Controls
    Select Case ctl.ControlType
    Case acTextBox, acComboBox, acListBox, ocxcalendar2
    ctl.Value = Null
    Case acCheckBox
    ctl.Value = False
    End Select
    Next ctl
    Me.Refresh
    Form_frmentries.Requery

    End Sub

    What am I missing here?!

    Many thanks
    F

  2. #2
    Board Regular
    Join Date
    Apr 2010
    Location
    California
    Posts
    576
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Help with runtime error 2448 you can't assign a value to this object

    Just prior to the line "ctl.Value = Null" put "Debug.Print ctl.name" (without quotes). Then run the code. When it jams on the line look in the immediate window and see the last control listed. That control cannot be set to null for some reason, probably because the underlying field is set to not accept nulls.

    hth,

    Rich

  3. #3
    New Member
    Join Date
    Oct 2007
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Help with runtime error 2448 you can't assign a value to this object

    Thanks, but I've just figured it out. I saw another post on a different forum about something similar that said to check if any of the controls had control sources. I was convinced none of mine had but I realised I'd put in another text box to test something out and then forgot about it. That control had a control source so now I've deleted it and it works now!

    Thanks anyway!

    F

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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