set form to current record when opened in access 2007

I have a form that lists records in my data table. From this form I can open another form for more details. When I select open on the current record the details form opens blank. I am not sure what it is I am over looking.

My main form is named List. I have a textbox named txtopen with a control source value of =IIf(IsNull([ID]),"(New)","Open"). I created a on click envent macro as follows.

Condition                        Action                            Arguments
                                      onError                              Next,
[Form].[Dirty]                  RunCommand                    SaveRecord
[MacroError].[Number]   MsgBox                            =[MacroError].[Description], Yes, None,
...                                    StopMacro
                                        OnError                            Fail,

                                       OpenForm                Details, Form, , ="[ID]=" & Nz([ID],0), , Dialog  
Not IsNull([ID])                 SetTempVar             CurrentID, [ID]
IsNull([ID])                       SetTempVar               CurrentID, Nz(DMax("[ID]",[Form].[RecordSource]),0)
                                         Requery
                                 SearchForRecord   Form, Mediation List, First, ="[ID]=" & [TempVars]![CurrentID]
                                  RemoveTempVar       CurrentID



Any help or advice would be greatly appreciated.

Genadian
                                       
genadianAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
You shouldn't need to Requery or SearchForRecord. Your OpenForm action should show you the record you wish, assuming there is only one record for each ID value
0
 
genadianAuthor Commented:
I removed the entries from the macro and saved the form. All is well now.

Thank you,
Genadian
0
All Courses

From novice to tech pro — start learning today.