• Form to open if query is not null

    Author
    Topic
    #458090

    Hi,
    I have a form that is used to import data from an excel spreadsheet. At the time of import, one of the things that needs to occur is a query of the database that looks to see if there any field’s that are being added that weren’t there previously. If the query is null, nothing should happen. However if the query is not null, then frmDefinitionUpdate should open. I’m not sure how to adapt the sql view of the query I build into code. If I past the following sql into the click event I get prompted that I’m missing various elements but I’m not sure what I need to do as coding is not my strong suit and I depend heavily on queries. This is the sql of the actual query that works fine.

    SELECT [tblPLFinance – GL].MEMO AS tblFinanceMemo, tblDefinitionSummary.MEMO, tblDefinitionSummary.SUMMARYCATEGORY, tblDefinitionSummary.SUMMARYNAME, tblDefinitionSummary.ITEM
    FROM [tblPLFinance – GL] LEFT JOIN tblDefinitionSummary ON [tblPLFinance – GL].MEMO = tblDefinitionSummary.MEMO
    WHERE (((tblDefinitionSummary.MEMO) Is Null));

    Thanks,
    Leesha

    Viewing 0 reply threads
    Author
    Replies
    • #1150611

      Since you have already stored this query (if I’m not mistaken), you can use something like this:

      If DCount(“*”, “NameOfTheQuery”) = 0 Then
      MsgBox “No records!”
      Exit Sub
      End If
      ‘ Code continues here only if query returns records

      Replace NameOfTheQuery with the name of your query.

      • #1150612

        Wow!! That is great and so much easier than the approach I was taking!!

        Thanks,
        Leesha

    Viewing 0 reply threads
    Reply To: Form to open if query is not null

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: