Problem with retrieved data

C_Monster221

New member
Local time
Yesterday, 17:10
Joined
Jan 23, 2009
Messages
8
Hi,

This is my problem I am simply trying to make a (i guess) a link to corresponding data from a report. I need to be able to click on say a peron's name listed on the report and have that peron's info open up in the corresponding form. I have a made a macro that does this yet it opens the same file regardless what name I click. I have converted this macro to vb for better help and understanding of what I am doing wrong.

Function Linking_Macro()
On Error GoTo Linking_Macro_Err
With CodeContextObject
On Error Resume Next
If (.Form.Dirty) Then
DoCmd.RunCommand acCmdSaveRecord
Exit Function
End If
On Error GoTo 0
DoCmd.OpenForm "frmconsumers", acNormal, "", ['[MEDRECNO]] = "'" & Nz([MEDRECNO], 0), , acDialog
If (Not IsNull(.MEDRECNO)) Then
TempVars.Add "CurrentID", "[MEDRECNO]"
End If
If (IsNull(.MEDRECNO)) Then
TempVars.Add "CurrentID", "Nz(DMax('[MEDRECNO]',[FRMCONSUMERS]),0)"
End If
DoCmd.Requery ""
DoCmd.SearchForRecord , "", acFirst, [[MEDRECNO]] = "'" & TempVars!CurrentID
TempVars.Remove "CurrentID"
End With

Linking_Macro_Exit:
Exit Function
Linking_Macro_Err:
MsgBox Error$
Resume Linking_Macro_Exit
End Function


This function opens the form but displays no info in it. Please note that all data in use is text.
 
Reports don't work that way. You can do that with a form, but not with a report.
 
I beg to differ, I mean it can be found in the NorthWind 2007 example. It can be seen when you click a name in the address book. Maybe i am just saying this wrong. But I need my report to work like that one does.

Thankx
 

Users who are viewing this thread

Back
Top Bottom