I was recently volunteered to finish off a Access database that a colleague had completed about 99% of before she left to another job. the db is being used as a Library Check In/Check Out database.
There is an action button that 'On Click' runs an Event procedure that is written in VBA. Upon clicking the action button I get the error "TempVars can only store data, they cannot store objects".
I don't have any prior experience with VBA or Access so I don't what's broken or how to fix. Any help would be greatly appreciated
Code:
'------------------------------------------------------------
' Action_Click
'
'------------------------------------------------------------
Private Sub Action_Click()
On Error GoTo Action_Click_Err
' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
' <UserInterfaceMacro For="Owner" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><Statements><ConditionalBlock><If><Condition>IsNull([Screen].[ActiveControl])</C
' _AXL:ondition><Statements><Action Name="StopMacro"/></Statements></If></ConditionalBlock><Action Name="OpenForm"><Argument Name="FormName">Contact Details</Argument><Argument Name="WhereCondition">="[ID]=" & [Screen].[ActiveControl]</Argument><Argum
' _AXL:ent Name="WindowMode">Dialog</Argument></Action><Action Name="OnError"/><Action Name="Requery"><Argument Name="ControlName">=[Screen].[ActiveControl].[Name]</Argument></Action></Statements></UserInterfaceMacro>
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