Results 1 to 5 of 5
  1. #1
    Steven19 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2020
    Location
    London
    Posts
    110

    OpenArgs Errors

    Can someone please help.



    I've done Open Args several times and I'm in the process of creating a Accident Database. However I have a page that just doesn't want to work.

    From MainMenu > FrmTypeofIncident > FrmReportingAccident > FormDescriptionofIncident all okay then I click continue

    Private Sub Closebtn_Click()
    DoCmd.OpenForm "FrmDescriptionofInjury", , , "[IncidentDescriptionID] = " & Me.IncidentDescriptionID, , , Me!IncidentDescriptionID
    End Sub

    And FrmDscriptionifInjury with

    Private Sub Form_Open(Cancel As Integer)
    If Me.OpenArgs <> "" Then
    Me![IncidentDescriptionID].DefaultValue = "" & Me.OpenArgs & ""
    End If
    End Sub

    Should open a new record, but Im getting the following error:

    Run-time Error 438
    Object doesn't support this property or method

    Me![IncidentDescriptionID].DefaultValue = "" & Me.OpenArgs & ""

    But I have done this dozens of times and don't see what is wrong.

    Can someone help me out please?
    Attached Files Attached Files

  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,521
    Your zip file appears to be empty. Make sure you're referring to the control, not the field:

    Me.TextboxName.DefaultValue
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you just need


    Me.IncidentDescriptionID.DefaultValue = Me.OpenArgs

    if
    IncidentDescriptionID is an autonumber, you cannot set a default


  4. #4
    Steven19 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2020
    Location
    London
    Posts
    110
    Actually there was nothing wrong with my code. I found that if I deleted the destination form and re-built it, then upon trying, it all worked.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it sorted out. The method Ajax posted would work as long as you didn't care about the default value being set to Null or "", which could potentially override an existing preset default.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Lost in a Maze of Me.OpenArgs
    By Tuckejam in forum Programming
    Replies: 2
    Last Post: 04-26-2020, 12:37 AM
  2. Replies: 4
    Last Post: 06-21-2014, 05:43 AM
  3. Replies: 5
    Last Post: 01-27-2013, 06:04 PM
  4. How to set openargs of sub report?
    By flippedbeyond in forum Programming
    Replies: 11
    Last Post: 09-20-2011, 08:24 PM
  5. Replies: 10
    Last Post: 07-25-2011, 12:07 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