Results 1 to 7 of 7
  1. #1
    doive1231 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    7

    TempVars Access 2003 equivalent for the Lending Library template

    Hello,



    I am trying to recreate the Access 2007 MS Lending Library template in Access 2003.

    The 2007 version uses the expression "TempVars" in the Asset field (Default Value =[TempVars]![ItemID]) of the Check out form to temporarily store the value of the asset I believe so that the asset is not available to check out in the Asset List form once the Check Out form data is completed.

    I have read that TempVars is a new expression in Access 2007 and was wondering what the equivalent expression would be in Access 2003? I'm thinking I should declare the asset number as a variable in VB so that it can update the Asset List form to show the asset as not available. Any help would be much appreciated.

    Thanks, Dave

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What exactly are you trying to do? I'd be more likely to calculate available or not from transactions, but that would depend on your table structure. For instance, if you had a transaction table that included item, checkout date/time and return date/time, then a query that found all records with no return date/time tells you everything that is out. An unmatched query of that against all items tells you what is available.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    doive1231 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    7
    Hello Paul,

    Thanks for your reply. I am using Access 2010.

    Yes, the Check Out form's record source is the table Transactions that includes the fields you mention. The Asset (ID) in this table is the many linked to the Asset table where it is unique.

    The Asset List form is a list of all the assets showing whether or not they are available to check out based on a query called Assets with Transactions.

    Clicking the (screen only hyperlink) Action field on the Asset List form (from the query this is Action: IIf([Contact Name]="" Or [Contact Name] Is Null,"Check Out","Check In") runs an embedded macro that sets the Status to Not Available or Overdue (if the return date has passed) - the query's Status field is Status: IIf([Contact Name]="" Or [Contact Name] Is Null,"Available",IIf([Due Date]<Date(),"Overdue","Not Available")). The macro On Click converted to VB is:


    '------------------------------------------------------------
    ' Action_Click
    '
    '------------------------------------------------------------
    Private Sub Action_Click()
    On Error GoTo Action_Click_Err

    If (IsNull(ID)) Then
    Beep
    Exit Sub
    End If
    TempVars.Add "ItemID", ID
    If (Nz([Contact Name]) <> "") Then
    DoCmd.OpenForm "Check In", acNormal, "", "[Transactions].[Asset]=[TempVars]![ItemID] And [Transactions].[Checked In Date] Is Null", acEdit, acDialog
    End If
    If (Nz([Contact Name]) = "") Then
    DoCmd.OpenForm "Check Out", acNormal, "", "1=0", acEdit, acDialog
    End If
    DoCmd.Requery ""


    Action_Click_Exit:
    Exit Sub

    Action_Click_Err:
    MsgBox Error$
    Resume Action_Click_Exit

    End Sub

    (although it said there were errors converting the Asset List form's macros to VB in Access 2010).

    Again there is the TempVars expression in the macro which appears too as a not visible field in the Check Out form. Selecting the Contact Name from a value list enables a button on the Check Out form so that the borrower is displayed alongside the item/asset finally on the Asset List form when closed.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The OpenForm line is doing this type of thing:

    BaldyWeb wherecondition

    but using TempVars (which I have to admit not to have used). I would just use a form reference.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    doive1231 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    7
    Paul, thanks again for your reply. I have actually used your wherecondition page before and it was a great help. I'm not massively up to speed with Access but I will look at the form reference. Is declaring a variable for the asset etc the way to go?

  6. #6
    doive1231 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    7
    Sorry, ignore the last bit of my last post. Just woke up.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help; glad you got it sorted out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Multiple Check Outs - Lending Library
    By Surferboy1500 in forum Access
    Replies: 4
    Last Post: 04-15-2012, 08:44 AM
  2. Report that Pulls from two Forms - Lending Library
    By Surferboy1500 in forum Access
    Replies: 8
    Last Post: 06-07-2011, 12:13 PM
  3. Check Out - Lending Library
    By Surferboy1500 in forum Access
    Replies: 2
    Last Post: 05-30-2011, 09:05 AM
  4. Lending library template
    By Viking in forum Access
    Replies: 5
    Last Post: 11-16-2010, 06:19 AM
  5. Replies: 2
    Last Post: 05-24-2010, 06:47 PM

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