Results 1 to 8 of 8
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    New booking but storing table ID via temp var

    How do I get a temp variable to store a value from one table into another?



    I have people making bookings however it may not be in their area and the responsibility might be given to another however in the bookings table I need to record who made that booking.

    How do I get their name to store from one table (tblOrganiser!ID) into the booking table (tblBookings!StoredID or name)using the temp var?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I've never used tempVars.

    Why do you need to store name? Just store their ID.
    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.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    I've never used tempVars.

    Why do you need to store name? Just store their ID.
    Ideally yes store their id, but display their name - they aren't connected to the area so if I tell the form to grab the associated id of the organizer it will grab the person responsible for that are not the person logged in making the booking at the time on behalf of the person responsible.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How do you know who is logged in? You save their name to a tempVar? Why not save their ID?

    How do you know who the responsible agent is? Is this somewhere on the booking form?

    For your situation, might be like:

    Me.StoredID = IIf(tempVar <> Me.ResponsibleID, tempVar, Me.ResponsibleID)

    I never used tempVars. I save the logged in user ID to a textbox on form that never closes (main menu) so it is always available for reference.

    I have used global declared variables but maybe I should consider tempVars instead.
    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. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I don't need to log a person (as in track if they are logged in), they just have to type in their surname which the query matches with the surname of the employee given to the area. If they don't type in the surname then they can't see the area because the query requires the surname to be the same as the one that is allocated to the area. (done by linking the table in the query to the bookings table)

    Instead of having to type in the parameter, the query fetches the current temp var (which you type in at the start). The problem is I want to match the temp var with an id and then have that id saved on the booking table. Then on the form display the name of that person according to the ID in that booking table.

    So essentially via the temp I need a way to bring in the id. I could add to the booking form query the surname field from the organiser and if it matches the temp field then it logs the id.

    I could save perhaps the tempvar which would be just the surname into the booking table - but that is not an id nor anything I can link back to the organiser table.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I just don't know your db well enough to offer specifics. I have provided concepts now you need to figure out how to apply to your situation.

    My users don't have to 'log in' either, they don't even have to type in their name. I grab their username from their network login, do a lookup to users table to get their ID, store ID in textbox on form. The ID is automatically saved with some records so we know who did what with the record at various stages of processing.
    Last edited by June7; 08-09-2013 at 11:52 AM.
    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.

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Nice setup you have

    I was thinking of doing a Dlookup - have the ID placed in if the surname is the same - not sure on the code yet but I will post whatever I come up with.

  8. #8
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I've sorted it by just pasting the surname tempvar into a field - that is enough for record keeping etc.

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

Similar Threads

  1. Updating main table from temp table AND form value
    By shabbaranks in forum Programming
    Replies: 8
    Last Post: 05-01-2013, 07:18 AM
  2. Temp table to prevent orphans
    By Tvanduzee in forum Database Design
    Replies: 1
    Last Post: 08-14-2012, 12:10 PM
  3. delete temp table
    By slimjen in forum Queries
    Replies: 1
    Last Post: 07-19-2012, 06:35 AM
  4. Query for temp linked table
    By compooper in forum Programming
    Replies: 8
    Last Post: 06-30-2011, 06:53 AM
  5. sql temp table creation for form
    By Ian_ in forum Forms
    Replies: 2
    Last Post: 06-17-2011, 03:27 AM

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