Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Oregon, USA
    Posts
    236
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Paste into Find Dialog Box (office pro 97 access)

    First I copied an ID number from a spreadsheet in Excel and moved to Access. Then I run this code from a key to set the focus in the ID field and open the find box.

    <font color=blue>Me!Acc.SetFocus
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70 </font color=blue>

    Now I want to paste the ID# which is in the clipboard into the find box. Maually I would just hit ^V. Can't seem to find the right combination. Neither of the following work:

    <font color=blue>DoCmd.RunCommand acCmdPaste
    DoCmd.DoMenuItem acFormBar, acEditMenu, 3, , acMenuVer70</font color=blue>

    Both return an error message "The type of object the action applies to isnt currently selected or isnt in the active view." I suppose that means you cant run a menu command in a find dialog box.

    So what is the code equivalent to <font color=red> ^V </font color=red>

    All of the "goto" and "search for" codes want me to specify the search criteria in advance. But I want to search for something new everytime.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Paste into Find Dialog Box (office pro 97 access)

    Throw away the Access 95 code and use the Access constants instead. Try this:

    DoCmd.RunCommand acCmdFind

    and this

    DoCmd.RunCommand acCmdCopy

    It isn't completely clear what you're trying to do here, though. Did you copy the value using code? If so, why are you using the Find dialog at all when you could do a find on the recordset in code? If not, why try to use code to paste the value into the Find dialog?

    It would be handy if Access had a Dialogs collection the way Word and Excel have, but I'm afraid we're out of luck there.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Oregon, USA
    Posts
    236
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Paste into Find Dialog Box (office pro 97 access)

    Tx Charlotte

    All I want to do is tell it to go find a ID# and update that entry. But I don't want to have to type the ID number in every time. I want to bring it from a cell in an Excel spreadsheet. Right now I simply copy the cell in Excel, move to Access, Open Find and Paste. Then I run a command button which does the update. I would like to incorporate the "Find" into the beginning of the update code.

    I looked at the recordsets info and it is way to complicated for me. Actually "seek" seems to be sort of what I want, but it looks as if it wants to work with tables and I want to search in a form.

    Currently I am using the old Macro writer from Win3.1. I have drug that along with me through every windows upgrade. I can use it to write one macro which spans both Excel and Access. Guess I will stick with that. Just thought maybe I was missing something in the Access codes. Still seems like there should be an easy way to tell it to go Find "paste in variable" and
    update it.

    If I had know you had to be a programmer to make Access work for you I would have stuck with my old PCButton shareware database.

    Anyway Thanks again...

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Paste into Find Dialog Box (office pro 97 access)

    You don't have to be a programmer to make Access work, only to make it work the way you *want* it to. <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15> You're dealing with extensions of Windows here, and that has come a long way since 3.1.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Maidstone, Kent, England
    Posts
    398
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Paste into Find Dialog Box (office pro 97 access)

    I think that you are looking for "SendKeys", but this is not the best way to do things and can catch you out sometimes!

    HTH

    Peter

  6. #6
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Oregon, USA
    Posts
    236
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Paste into Find Dialog Box (office pro 97 access)

    Tx Peter I haven't looked at SendKeys at all. Will give that some study in the near future.

    At least I now I know I haven't missed anything obvious -- this time.

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Paste into Find Dialog Box (office pro 97 access)

    Hi Charlotte

    In a2k I notice wizards generate doCmd.DoMenuItem code.

    Is there a utility that will change DoMenuItem to RunCommand?

    How long will DoMenuItem be supported?

    Should I worry about it?

    Thanks, John

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Paste into Find Dialog Box (office pro 97 access)

    Well, logically they have to keep supporting it since their wizards are still writing Access 95 code. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15> I don't know of any utility, although there's probably one out there somewhere. I don't use the wizards very often, so I haven't bothered to look for anything to fix their stale code.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •