Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Posts
    37

    Unanswered: SQL in Access VBA

    I'm trying to make a query in vba and am having problems finding examples and the proper sytnax, so if anyone can lend their brain to me for a bit I'd appreciate it. Basically what I am trying to do is run a query from a form which checks for duplicate ID's based upon the new record the user just created from the form.

    The query I am using is this:

    SELECT First(Redesign_Master.[New Msa Code]) AS [New Msa Code Field], Count([Forms]![frm_Master_Entry]![New Msa Code]) AS NumberOfDups
    FROM Redesign_Master
    GROUP BY Redesign_Master.[New Msa Code]
    HAVING (((Count([Forms]![frm_Master_Entry]![New Msa Code]))>1) AND ((Redesign_Master.[New Msa Code])=[Forms]![frm_Master_Entry]![New Msa Code]));

    If anyone has some insight, thanks in advance

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Where do you need to put the resulting information?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Nov 2002
    Posts
    37
    Quote Originally Posted by Teddy
    Where do you need to put the resulting information?
    Ideally I would put the query results into a recordset which I could the use in various logical comparisons.

  4. #4
    Join Date
    Jan 2005
    Posts
    68
    try creating a dao querydef (check the vba online help for an example)

Posting Permissions

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