From: Harry on

Hello

I'd like to be able to press a button on an Excel sheet and start the process of
running the MSQUERY function. I tried just recording keystrokes as a macro,
clicking the following while in record mode:

Data/Import External Data/New Database Query/MS Access Database/Clicked on
Database Name

But nothing got recorded, it didn't work. I'm trying to save myself all those
keystrokes by automating the task right up to the point in the query where I
select which record I to import from the Access file.

I know enough about macros and VB to create a button and launch the macro, but
I'm really new at this. Does anyone have any code that can do a query from
Excel in an access file, pulling out a record of their choice?

Thanks

Harry


From: Tom Ogilvy on
http://www.erlandsendata.no/english/index.php?t=envbadac

--
Regards,
Tom Ogilvy


"Harry" <harry-fine(a)rogers.com> wrote in message
news:4215ed18.3859625(a)nntp.broadband.rogers.com...
>
> Hello
>
> I'd like to be able to press a button on an Excel sheet and start the
process of
> running the MSQUERY function. I tried just recording keystrokes as a
macro,
> clicking the following while in record mode:
>
> Data/Import External Data/New Database Query/MS Access Database/Clicked on
> Database Name
>
> But nothing got recorded, it didn't work. I'm trying to save myself all
those
> keystrokes by automating the task right up to the point in the query where
I
> select which record I to import from the Access file.
>
> I know enough about macros and VB to create a button and launch the macro,
but
> I'm really new at this. Does anyone have any code that can do a query
from
> Excel in an access file, pulling out a record of their choice?
>
> Thanks
>
> Harry
>
>


From: Harry on
Tom, it may be over my head. As I read about this, it seems I need to have
ADO or DAO running (I don't know what they are, nor the difference) and perhaps
a database, Oracle or SQL. Is there a faq that takes me through ADO or DAO, so
I can get the big picture of what has to be happening?

Harry


On Fri, 18 Feb 2005 08:44:41 -0500, "Tom Ogilvy" <twogilvy(a)msn.com> wrote:

>http://www.erlandsendata.no/english/index.php?t=envbadac
>
>--
>Regards,
>Tom Ogilvy
>
>
>"Harry" <harry-fine(a)rogers.com> wrote in message
>news:4215ed18.3859625(a)nntp.broadband.rogers.com...
>>
>> Hello
>>
>> I'd like to be able to press a button on an Excel sheet and start the
>process of
>> running the MSQUERY function. I tried just recording keystrokes as a
>macro,
>> clicking the following while in record mode:
>>
>> Data/Import External Data/New Database Query/MS Access Database/Clicked on
>> Database Name
>>
>> But nothing got recorded, it didn't work. I'm trying to save myself all
>those
>> keystrokes by automating the task right up to the point in the query where
>I
>> select which record I to import from the Access file.
>>
>> I know enough about macros and VB to create a button and launch the macro,
>but
>> I'm really new at this. Does anyone have any code that can do a query
>from
>> Excel in an access file, pulling out a record of their choice?
>>
>> Thanks
>>
>> Harry
>>
>>
>
>

From: Tom Ogilvy on
You can start here. Look on the left side.

http://msdn.microsoft.com/data/Default.aspx

However, you may just want to go back to using MSQuery. Turn on the macro
recorder while you do the Data=>Get External Data (or import external data)
in the menus and pull down your data. Then turn off the macro recorder and
look at what has been recorded. You can make the database a variable in the
code recorded, then just add an input prompt for what database.

--
Regards,
Tom Ogilvy

"Harry" <harry-fine(a)rogers.com> wrote in message
news:4215fcd3.7885968(a)nntp.broadband.rogers.com...
> Tom, it may be over my head. As I read about this, it seems I need to
have
> ADO or DAO running (I don't know what they are, nor the difference) and
perhaps
> a database, Oracle or SQL. Is there a faq that takes me through ADO or
DAO, so
> I can get the big picture of what has to be happening?
>
> Harry
>
>
> On Fri, 18 Feb 2005 08:44:41 -0500, "Tom Ogilvy" <twogilvy(a)msn.com> wrote:
>
> >http://www.erlandsendata.no/english/index.php?t=envbadac
> >
> >--
> >Regards,
> >Tom Ogilvy
> >
> >
> >"Harry" <harry-fine(a)rogers.com> wrote in message
> >news:4215ed18.3859625(a)nntp.broadband.rogers.com...
> >>
> >> Hello
> >>
> >> I'd like to be able to press a button on an Excel sheet and start the
> >process of
> >> running the MSQUERY function. I tried just recording keystrokes as a
> >macro,
> >> clicking the following while in record mode:
> >>
> >> Data/Import External Data/New Database Query/MS Access Database/Clicked
on
> >> Database Name
> >>
> >> But nothing got recorded, it didn't work. I'm trying to save myself
all
> >those
> >> keystrokes by automating the task right up to the point in the query
where
> >I
> >> select which record I to import from the Access file.
> >>
> >> I know enough about macros and VB to create a button and launch the
macro,
> >but
> >> I'm really new at this. Does anyone have any code that can do a query
> >from
> >> Excel in an access file, pulling out a record of their choice?
> >>
> >> Thanks
> >>
> >> Harry
> >>
> >>
> >
> >
>


From: Harry on
Tom,

As I mentioned in my first post, the Record Macro route doesn't record anything.
I don't understand it. I START recording, go half-way through the process of
importing a record from an Access file, I STOP recording the macro, and here's
what it shows me in the macro editor:


Sub Test()
'
' Test Macro
' Macro recorded 18/02/2005 by Harry Fine
'

'
End Sub


That's it. Where is the macro?

Harry



On Fri, 18 Feb 2005 10:44:03 -0500, "Tom Ogilvy" <twogilvy(a)msn.com> wrote:

>You can start here. Look on the left side.
>
>http://msdn.microsoft.com/data/Default.aspx
>
>However, you may just want to go back to using MSQuery. Turn on the macro
>recorder while you do the Data=>Get External Data (or import external data)
>in the menus and pull down your data. Then turn off the macro recorder and
>look at what has been recorded. You can make the database a variable in the
>code recorded, then just add an input prompt for what database.
>
>--
>Regards,
>Tom Ogilvy
>
>"Harry" <harry-fine(a)rogers.com> wrote in message
>news:4215fcd3.7885968(a)nntp.broadband.rogers.com...
>> Tom, it may be over my head. As I read about this, it seems I need to
>have
>> ADO or DAO running (I don't know what they are, nor the difference) and
>perhaps
>> a database, Oracle or SQL. Is there a faq that takes me through ADO or
>DAO, so
>> I can get the big picture of what has to be happening?
>>
>> Harry
>>
>>
>> On Fri, 18 Feb 2005 08:44:41 -0500, "Tom Ogilvy" <twogilvy(a)msn.com> wrote:
>>
>> >http://www.erlandsendata.no/english/index.php?t=envbadac
>> >
>> >--
>> >Regards,
>> >Tom Ogilvy
>> >
>> >
>> >"Harry" <harry-fine(a)rogers.com> wrote in message
>> >news:4215ed18.3859625(a)nntp.broadband.rogers.com...
>> >>
>> >> Hello
>> >>
>> >> I'd like to be able to press a button on an Excel sheet and start the
>> >process of
>> >> running the MSQUERY function. I tried just recording keystrokes as a
>> >macro,
>> >> clicking the following while in record mode:
>> >>
>> >> Data/Import External Data/New Database Query/MS Access Database/Clicked
>on
>> >> Database Name
>> >>
>> >> But nothing got recorded, it didn't work. I'm trying to save myself
>all
>> >those
>> >> keystrokes by automating the task right up to the point in the query
>where
>> >I
>> >> select which record I to import from the Access file.
>> >>
>> >> I know enough about macros and VB to create a button and launch the
>macro,
>> >but
>> >> I'm really new at this. Does anyone have any code that can do a query
>> >from
>> >> Excel in an access file, pulling out a record of their choice?
>> >>
>> >> Thanks
>> >>
>> >> Harry
>> >>
>> >>
>> >
>> >
>>
>
>