Hi,
I had an embedded macro that i converted to VBA code...now, it does not work anymore...
My situation:
I have 2 forms;
- frm_trajecten - list of clients
based on a Query: Q_trajecten which is based on a table tbl_trajecten
- frm_traject_det ails - details of a client
based on query Q_trajecten_det ails which is based on table tbl_trajecten
in tbl_trajecten (and both queries i have a field [ID_traject]
On frm_trajecten i have a field [tr_naam_traject] with a hyperlink with the following code;
When executing the code i actually opens the form frm_traject_det ails, which is good.
However, when i try to close the form i get an error message on the line:
Saying "tempvars can only store data, they cannot store objects"
It stops the code", goes back to the form frm_trajecten after which nothing works anymore (it is stuck)
How can this be corrected ?
Thanks for helping me !
Pierkes
I had an embedded macro that i converted to VBA code...now, it does not work anymore...
My situation:
I have 2 forms;
- frm_trajecten - list of clients
based on a Query: Q_trajecten which is based on a table tbl_trajecten
- frm_traject_det ails - details of a client
based on query Q_trajecten_det ails which is based on table tbl_trajecten
in tbl_trajecten (and both queries i have a field [ID_traject]
On frm_trajecten i have a field [tr_naam_traject] with a hyperlink with the following code;
Code:
Private Sub tr_naam_traject_Click()
On Error GoTo tr_naam_traject_Click_Err
On Error Resume Next
If (Form.Dirty) Then
DoCmd.RunCommand acCmdSaveRecord
End If
If (MacroError.Number <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
Exit Sub
End If
On Error GoTo 0
DoCmd.OpenForm "frm_traject_details", acNormal, "", "[ID_traject]=" & Nz(ID_traject, 0), , acDialog
If (Not IsNull(ID_traject)) Then
TempVars.Add "CurrentID", ID_traject
End If
If (IsNull(ID_traject)) Then
TempVars.Add "CurrentID", Nz(DMax("[ID_traject]", Form.RecordSource), 0)
End If
DoCmd.Requery ""
DoCmd.SearchForRecord , "", acFirst, "[ID_traject]=" & TempVars!CurrentID
TempVars.Remove "CurrentID"
tr_naam_traject_Click_Exit:
Exit Sub
tr_naam_traject_Click_Err:
MsgBox Error$
Resume tr_naam_traject_Click_Exit
End Sub
However, when i try to close the form i get an error message on the line:
Code:
If (Not IsNull(ID_traject)) Then
TempVars.Add "CurrentID", ID_traject
It stops the code", goes back to the form frm_trajecten after which nothing works anymore (it is stuck)
How can this be corrected ?
Thanks for helping me !
Pierkes
Comment