Results 1 to 3 of 3
  1. #1
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010

    Get a textbox to return the max number contained in a table

    Ok I have a Job Form who use a table with those field


    No is the number the user see and is entered manually and is a String cause it can be appended with letters...
    What i want is when the user create a new Job my field for No gets automaticly the highest number from tbl_Job.No even though it's string... and might contain letters...

    I don't know if it helps but the first 5 char of the strings are always the number, the letters come after

  2. #2
    ajetrumpet is offline Banned
    Windows Vista Access 2007
    Join Date
    Mar 2010
    I don't think you can do that, because domain functions look up the whole field, but you can use a query to store the numbers and then use a domain function:

    query sql:
    select clng(left([field], 5)) 
    then on the form with the ON CURRENT event, write something like this in the code:
    if me.newrecord then
    .textboxname dmax("queryfield""queryname")
    end if 

  3. #3
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    thx it works !

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

Similar Threads

  1. return last value in a sorted query / table
    By markjkubicki in forum Programming
    Replies: 5
    Last Post: 07-07-2010, 08:56 AM
  2. Writing data from textbox to table
    By mll in forum Forms
    Replies: 4
    Last Post: 03-10-2010, 05:10 PM
  3. Report TextBox printing ID Number, not text
    By ZipDoc in forum Reports
    Replies: 8
    Last Post: 02-01-2010, 12:30 PM
  4. Replies: 5
    Last Post: 10-08-2009, 05:15 AM
  5. Replies: 1
    Last Post: 02-05-2009, 04:53 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 - Senior Forums