Results 1 to 3 of 3
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    How to code a missing parameter

    I wrote the following statement intending that the 1st parameter be deemed "Missing" in the receiving Sub.

    Code:
    Call PopulateControls(, "YTD")
    However, in the sub:



    Code:
    Private Sub PopulateControls(Optional PCDate As Date, Optional Sufx As String = "")
    Debug reveals that the value of PCDate is the time of day, whereas I'm wanting that IsMissing(PCDate) equal true.

    How should the "Call" be coded to designate an intentionally missing parameter?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    put in ANY date at the front even if you dont use it,
    call PopulateControls("1/1/11, "YTD")

    or in the function itself , check for null and adjust inside it.

    or dont allow the OPTIONAL, so you can send a null.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks, that's essentially what I ended up doing. I pass the date EPOCH as date when I want the function to ignore that parameter.

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

Similar Threads

  1. Replies: 3
    Last Post: 08-31-2015, 10:12 AM
  2. missing parameter value
    By markjkubicki in forum Forms
    Replies: 6
    Last Post: 06-30-2015, 10:35 AM
  3. Missing one line of code
    By jj1 in forum Access
    Replies: 9
    Last Post: 05-21-2014, 04:36 PM
  4. Code for Parameter Form
    By Huddle in forum Access
    Replies: 16
    Last Post: 02-27-2012, 01:39 PM
  5. Missing references and running code at startup
    By springrider in forum Programming
    Replies: 1
    Last Post: 01-09-2011, 09:47 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