Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423

    Do they need to know the calculated value at the outset? I would think that is key.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    Join Date
    Apr 2017
    Posts
    1,792
    Quote Originally Posted by Welshgasman View Post
    Can you really use SQL like that?
    Sorry! Had my attention on query part entirely.
    Code:
    Set NextAppID = (SELECT TOP 1 ApplID FROM tblApplicant ORDER BY ApplID DESC)+1
    or
    Set @NextAppID = (SELECT TOP 1 ApplID FROM tblApplicant ORDER BY ApplID DESC)+1
    

  3. #18
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    I cannot get that to work.
    If the variable is long I get sql1, if I remove the quotes I get sql 2, and if I change the variable to an object I get sql3
    Attached Thumbnails Attached Thumbnails sql1.png   sql2.png   sql3.png  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What was your solution?

    Did you see the posts that suggested using DMax()?

    Arvil, did you test your suggestion? Works for you?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #20
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    I would have thought the correct syntax would be

    NextAppID = currentdb.openrecordset("SELECT TOP 1 ApplID FROM tblApplicant ORDER BY ApplID DESC")(0) + 1

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query not giving required result using max function
    By mithinxavier in forum Queries
    Replies: 6
    Last Post: 01-15-2016, 09:04 AM
  2. Assigning a variable
    By tguitard in forum Programming
    Replies: 1
    Last Post: 05-02-2013, 12:22 PM
  3. Replies: 2
    Last Post: 03-15-2013, 12:49 PM
  4. using ADO, assigning a date variable
    By crowegreg in forum Programming
    Replies: 3
    Last Post: 08-23-2011, 12:00 AM
  5. assigning a variable
    By crowegreg in forum Programming
    Replies: 1
    Last Post: 08-22-2011, 05:55 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