Tags: access, canned, database, everytime, feature, form, microsoft, mysql, oracle, record, regularly, sql, time, users, vba

Find Record using VBA

On Database » Microsoft Access

2,734 words with 2 Comments; publish: Fri, 06 Jun 2008 12:16:00 GMT; (250101.56, « »)

My users have a form that they regularly use the find record feature - every

time they go into the form for the first time and use this canned feature, it

defaults to:

Field: <CurrentField>

Find: All of Field

I want them to be able to right away search all the form number one, and also

"Any part of field" - is there some way with VBA I could attach a procedure

to a button ?

Message posted via droptable.com

http://www.droptable.com/Uwe/Forums...forms/200511/1

All Comments

Leave a comment...

  • 2 Comments
    • Boy are you lucky!

      I solved just that problem the other day.

      Here is my code:

      Private Sub butFind_Click()

      ' Display customized Find and Replace window

      DoCmd.GoToControl "Type" <===== has to be a searchable control

      SendKeys "%l{DOWN}%ha%n"

      RunCommand acCmdFind

      End Sub

      Check out VBA Help for the Sendkeys statement. It can be very useful in lots

      of circumstances.

      - Dorian

      "Steven R via droptable.com" wrote:

      > My users have a form that they regularly use the find record feature - every

      > time they go into the form for the first time and use this canned feature, it

      > defaults to:

      > Field: <CurrentField>

      > Find: All of Field

      > I want them to be able to right away search all the form number one, and also

      > "Any part of field" - is there some way with VBA I could attach a procedure

      > to a button ?

      > --

      > Message posted via droptable.com

      > http://www.droptable.com/Uwe/Forums...forms/200511/1

      >

      #1; Fri, 06 Jun 2008 12:17:00 GMT
    • Dorian,

      Thanks !

      I thought I saw a more complicated way of doing it some time ago, but your's

      looks like a great solution - some people frown on Send Keys, but I haven't

      got to that point where I've seen the evils of Send Keys - I will implement

      that code...

      Thanks Again !

      Steve

      mscertified wrote:[vbcol=seagreen]

      >Boy are you lucky!

      >I solved just that problem the other day.

      >Here is my code:

      >Private Sub butFind_Click()

      > ' Display customized Find and Replace window

      > DoCmd.GoToControl "Type" <===== has to be a searchable control

      > SendKeys "%l{DOWN}%ha%n"

      > RunCommand acCmdFind

      >End Sub

      >Check out VBA Help for the Sendkeys statement. It can be very useful in lots

      >of circumstances.

      >- Dorian

      >[quoted text clipped - 6 lines]

      Message posted via http://www.droptable.com

      #2; Fri, 06 Jun 2008 12:18:00 GMT