Results 1 to 5 of 5
  1. #1
    RKMSN is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    2

    Form Loaded

    Hi, I have a Function below, I am calling this in query and having error when form is not loaded or closed and i want that if form is not loaded then the query to show all records or in simple words should ignore this criteria without any pop up error message




    Function IsFormLoaded(strForm As String) As Boolean

    Dim frm As Form

    For Each frm In Forms
    If frm.Name = strForm Then
    IsFormLoaded = True
    Exit Function
    End If
    Next

    End Function


    Calling with if condition in query ;

    IIf(IsFormLoaded('searchins'),[Forms]![SearchIns]![dr2],")
    Attached Thumbnails Attached Thumbnails Untitled2.png   Untitled.png  

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,892
    dont us a form param in a query if the form isnt going to be loaded.
    instead use a different query if the form is not loaded.
    Why use the param query if the form isnt loaded?

    even if you don't use the param, the formula must resolve all options....error.

  3. #3
    RKMSN is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    2
    Thanks for the reply
    I am newbie to vba coding and thats the reason, i dont understand what you mean to say by param ?

  4. #4
    Gicu's Avatar
    Gicu is online now Expert
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    978
    Can you try :

    IIf(IsFormLoaded("SearchIns"),[Forms]![SearchIns]![dr2],Like "*" OR Is Null)

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,741
    apparently cross posted under different username with answers
    https://www.access-programmers.co.uk...d.php?t=308994
    please read https://www.excelguru.ca/content.php?184
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    "Everyone has a photographic memory; some just don't have film." Steven Wright

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

Similar Threads

  1. Replies: 2
    Last Post: 08-07-2018, 10:53 AM
  2. Replies: 2
    Last Post: 11-09-2016, 05:54 PM
  3. Code only works after form is loaded 2nd time
    By joecamel9166 in forum Forms
    Replies: 1
    Last Post: 05-05-2016, 02:12 PM
  4. How to detect a form is FULLY loaded?
    By robs23 in forum Forms
    Replies: 4
    Last Post: 08-25-2014, 10:38 AM
  5. How to check if any form is loaded
    By Kivan in forum Programming
    Replies: 3
    Last Post: 09-03-2012, 08:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums