Results 1 to 2 of 2
  1. #1
    derisco1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2011
    Location
    Chandler AZ
    Posts
    1

    Manual incrementing of a field

    Former FoxPro Programmer struggling with Access 2010
    To find the simplest thing takes days to find among all the stupid stuff I cannot find how to take the last record in the table get the records value (numeric) which is a serial number in a SQL Query and add 1 to it and append the next record and put that value in it. In Foxpro it was simple:
    go bottom
    store empno +1 to mempno
    append blank
    replace empno with mempno

    Done
    I have been going in circles and because Access has auto numbering fields (I cannot use them, I have to do no harm to the other programmers data). I do not have the luxury of doing anything with the structure of the SQL Database I cannot find the answer I have answered no to the error message (Was this information helpful) so many times was this helpful my mouse is broken. I have tried writing macros but they are extreamly limited I am not that familiar with VB but I have to get my head around it.
    Here is the code for a append query that almost works but I can not get the last record number field value so I can add 1 to it:
    SQL Query:
    INSERT INTO dbo_EmployeeCloseOut ( LocationNo, EmployeeCloseOutNo, CloseDate, RegisterNo )
    SELECT 1 AS Expr3, [dbo_EmployeeCloseOut]![EmployeeCloseOutNo]+1 AS Expr1, Date()+Time() AS Expr2, [Drawer Rec].[Register No]


    FROM [Drawer Rec] LEFT JOIN EmployeeCloseOut ON [Drawer Rec].[Register No] = dbo_EmployeeCloseOut.RegisterNo;
    I do not have the ability to change the target database structure and I have to adhear to their numbering sequence. Usually there are four records in the drawer rec file to add to the employeecloseout file and I want to link the two by EmployeeCloseOutNo, so when I get the number I have to place it in both tables.
    Thanks for looking at this.
    Last edited by derisco1; 08-11-2011 at 05:10 PM. Reason: oops

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

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

Similar Threads

  1. Manual Switchboard Form
    By paradox6996 in forum Forms
    Replies: 2
    Last Post: 05-03-2011, 05:36 PM
  2. Replies: 10
    Last Post: 01-31-2011, 02:16 PM
  3. Incrementing a field
    By Wayne311 in forum Programming
    Replies: 20
    Last Post: 01-20-2011, 06:21 PM
  4. Any recommendations for a manual?
    By timmyjohnson in forum Access
    Replies: 0
    Last Post: 04-18-2010, 05:30 PM
  5. Adding a Manual Date
    By JimmyT in forum Database Design
    Replies: 1
    Last Post: 04-21-2009, 06:12 AM

Tags for this Thread

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