Easy one...

  • Thread starter Thread starter sameat
  • Start date Start date
S

sameat

Please excuse my complete lack of knowledge.

I want my fom to ask me for which record to display when I open it.

How do I do that?
 
Please excuse my complete lack of knowledge.

I want my fom to ask me for which record to display when I open it.

How do I do that?

A nice way to handle this is to add an unbound TextBox or ComboBox to the form
labelled "Go To...". Then you initially open the form displaying no record...

DoCmd.OpenForm "FormName",,,"False"
("False" is just shorthand for a filter that is never satisfied).

Then you use the AfterUpdate event of the unbound control to apply a filter that
is satisfied by exactly one record.

(if primary key field is numeric)
Me.Filter = "PrimaryKeyField = " & Me.GoToControlName
Me.FilterOn = True

(if primary key field is text)
Me.Filter = "PrimaryKeyField = '" & Me.GoToControlName & "'"
Me.FilterOn = True
 
Back
Top