Results 1 to 5 of 5
  1. #1
    Howdy is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    2

    Error '2450'

    Howdy,



    I have a DB that utilizes buttons and forms to move throughout the database. In many forms, I have 2 fields, a QUOTEID form and a PROJECT NUMBER form. This is so that you can access the same form by entering either the QUOTEID or PROJECT NUMBER. I have written the vba code for it below.

    Private Sub ButtonTest_Click()
    If QUOTEID = "" Then
    DoCmd.OpenForm "JobQuotes", , , [PROJECT NUMUBER] = [Forms]![JobQuotes]![PROJECT NUMBER]
    Else
    DoCmd.OpenForm "JobQuotes", , , [QUOTEID] = [Forms]![JobQuotes]![QUOTEID]
    End If
    End Sub

    I have read lots of forums on this topic and believe I am getting an instanced copy of the form open somehow, somewhere that is not allowing it to execute. The bold text is what is highlighted in the debug window. I have a workaround with 2 buttons, one to open the JobQuotes form with QUOTEID, and one for the PROJECT NUMBER, but I am unsure why I can't just do it in my VBA code on 1 button.

    Any advice/help is appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Your syntax is off, see here:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Howdy is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    2
    Changed syntax but it doesn't pull the correct record (sometimes pulls all records from back-end query) and prompts me to enter the parameter value before moving on. I am going from a form (not associated with any record), and have 2 unbound text boxes on that form. I want to just call the DoCmd.OpenForm and set the New Form = to one of the unbound text boxes that have a value entered. Not from a form with a specific record, to a form of the same record.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The parameter prompt is Access telling you it can't find whatever is named in the prompt, so check your spelling. The textboxes don't have to be bound, so this should still work. You didn't post your new syntax so I can't say if it's okay now.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    DoCmd.OpenForm "JobQuotes", , , [QUOTEID] = [Forms]![JobQuotes]![QUOTEID]

    What form are you opening this from?
    the form reference should be from the form you are calling it from.

    should be something along the lines of...

    Code:
    DoCmd.OpenForm "JobQuotes", , , "[QUOTEID] = " & Me.QUOTEID
    also note that
    Code:
    If QUOTEID = "" Then
    may not be returning what you think if the control is null and not a zls.

    you can test for both with If nz(QuoteID,"")<>"" then

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

Similar Threads

  1. Run-time error 2450
    By ReliabilityDave in forum Programming
    Replies: 1
    Last Post: 04-04-2018, 12:13 PM
  2. 2450 Error and How to Error Trap it
    By robbeh in forum Programming
    Replies: 11
    Last Post: 10-08-2014, 12:21 PM
  3. Replies: 1
    Last Post: 03-05-2014, 07:55 AM
  4. Run-Time Error 2450
    By dascoli in forum Programming
    Replies: 7
    Last Post: 05-28-2013, 10:49 AM
  5. error run time 2450
    By storm1954 in forum Forms
    Replies: 2
    Last Post: 05-11-2012, 06:05 AM

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
  •  
Other Forums: Microsoft Office Forums