DoCmd.Open form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to open a form and restrict which records are displayed on it...
here's what I've got:

DoCmd.OpenForm "frmConfigValue", , , "Key = 'TargetArchive'"

Problem is that all the records from the table are being displayed on the
form... the Whereclause above doesn't seem to be having an effect... any idea
what the problem is here?
 
Its seems to be OK.
Does the records display in a subform? If that the case the where statement
doesn't apply to sub form, only to the main form
 
No, the form I'm opening, frmConfigValue, is to open as a form itself, not as
a sub-form inside another form....
 
Do you have any code on the Load event of the form, where you might change
the record source?
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
Oops... yea that's it... I should have remembered that...

So now, will I be able make use of the paramter in that DoCmd.Open command?
If so, how?
 
Yes you can, try and pass the criteria using the OpenArgs
DoCmd.OpenForm "frmConfigValue", , , , , ,"Key = 'TargetArchive'"
On the Load event you can add the OpenArgs as a criteria

Me.RecordSource = "Select TableName.* From TableName Where " & Me.OpenArgs
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
Back
Top