Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post
    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='Leesha' post='763960' date='06-Mar-2009 21:22'][/quote]
    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.

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post
    Wow!! That is great and so much easier than the approach I was taking!!

    Thanks,
    Leesha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •