|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Is Any one can tell me about this.
I have to fetch data from MS-Access into word document by pressing a different keystrokes.
Let here is example wht i have to do... In open word document When I press keystroke <Alt>+M...it would retrieve data whose names starts with 'M' from ms-access table ; similarly if i press <Alt>+L...it would retrieve data whose names starts with 'L' from ms-access table . And how to display these data in word document. I am using macros but when i create one macro with keystroke other keystroke doesn't work.
Can anybody solve this problem & guide me how i can get out from this problem.
Thanx.......
|
|
1. Create a function that retrieves data from your database. The function should take an argument -- the letter for which you want to retrieve data, eg --
Private Sub GetNames(FirstLetter as string)
... retrieve and insert ... ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & Left$(FirstLetter,1) & "*'";)
... End Sub
2. Create a method for calling this macro, specifying the argument. You could use 26 separate macros, eg --
Sub GetNames_L() GetNames("L") End Sub
etc
.... but you might want to play around with this. There are many other options for user input; eg a userform and an input box.
<amod.kumar29[ at ]gmail.com> wrote in message news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com...
[Quoted Text] > Is Any one can tell me about this. > > I have to fetch data from MS-Access into word document by pressing a > different keystrokes. > > Let here is example wht i have to do... > In open word document When I press keystroke <Alt>+M...it would > retrieve data whose names starts with 'M' from ms-access table ; > similarly if i press <Alt>+L...it would retrieve data whose names > starts with 'L' from ms-access table . > And how to display these data in word document. I am using macros but > when i create one macro with keystroke other keystroke doesn't work. > > Can anybody solve this problem & guide me how i can get out from this > problem. > > > Thanx....... >
|
|
thanx Jezebel
How can I bound label control with data from ms-access.
Jezebel wrote:
[Quoted Text] > 1. Create a function that retrieves data from your database. The function > should take an argument -- the letter for which you want to retrieve data, > eg -- > > Private Sub GetNames(FirstLetter as string) > > ... retrieve and insert ... > ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & > Left$(FirstLetter,1) & "*'";) > > ... > End Sub > > > 2. Create a method for calling this macro, specifying the argument. You > could use 26 separate macros, eg -- > > Sub GetNames_L() > GetNames("L") > End Sub > > etc > > ... but you might want to play around with this. There are many other > options for user input; eg a userform and an input box. > > > > > > <amod.kumar29[ at ]gmail.com> wrote in message > news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com... > > Is Any one can tell me about this. > > > > I have to fetch data from MS-Access into word document by pressing a > > different keystrokes. > > > > Let here is example wht i have to do... > > In open word document When I press keystroke <Alt>+M...it would > > retrieve data whose names starts with 'M' from ms-access table ; > > similarly if i press <Alt>+L...it would retrieve data whose names > > starts with 'L' from ms-access table . > > And how to display these data in word document. I am using macros but > > when i create one macro with keystroke other keystroke doesn't work. > > > > Can anybody solve this problem & guide me how i can get out from this > > problem. > > > > > > Thanx....... > >
|
|
This gets very messy. Do you really want to bind it, or just read the data and display it?
"VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message news:1152614221.292320.253350[ at ]m73g2000cwd.googlegroups.com...
[Quoted Text] > thanx Jezebel > > How can I bound label control with data from ms-access. > > > > > > Jezebel wrote: >> 1. Create a function that retrieves data from your database. The function >> should take an argument -- the letter for which you want to retrieve >> data, >> eg -- >> >> Private Sub GetNames(FirstLetter as string) >> >> ... retrieve and insert ... >> ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & >> Left$(FirstLetter,1) & "*'";) >> >> ... >> End Sub >> >> >> 2. Create a method for calling this macro, specifying the argument. You >> could use 26 separate macros, eg -- >> >> Sub GetNames_L() >> GetNames("L") >> End Sub >> >> etc >> >> ... but you might want to play around with this. There are many other >> options for user input; eg a userform and an input box. >> >> >> >> >> >> <amod.kumar29[ at ]gmail.com> wrote in message >> news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com... >> > Is Any one can tell me about this. >> > >> > I have to fetch data from MS-Access into word document by pressing a >> > different keystrokes. >> > >> > Let here is example wht i have to do... >> > In open word document When I press keystroke <Alt>+M...it would >> > retrieve data whose names starts with 'M' from ms-access table ; >> > similarly if i press <Alt>+L...it would retrieve data whose names >> > starts with 'L' from ms-access table . >> > And how to display these data in word document. I am using macros but >> > when i create one macro with keystroke other keystroke doesn't work. >> > >> > Can anybody solve this problem & guide me how i can get out from this >> > problem. >> > >> > >> > Thanx....... >> > >
|
|
Dear Jezebel...
I want to display data from ms-access into ms-word controls using keystokes. My query is running accurately but i am not able to bind it to Label control in word document. Record is displaying properly when I press keystokes into the MsgBox but not able to display those records in Label Control.
expecting u'll give clear solution from urside....
thanx .....
Jezebel wrote:
[Quoted Text] > This gets very messy. Do you really want to bind it, or just read the data > and display it? > > > > "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message > news:1152614221.292320.253350[ at ]m73g2000cwd.googlegroups.com... > > thanx Jezebel > > > > How can I bound label control with data from ms-access. > > > > > > > > > > > > Jezebel wrote: > >> 1. Create a function that retrieves data from your database. The function > >> should take an argument -- the letter for which you want to retrieve > >> data, > >> eg -- > >> > >> Private Sub GetNames(FirstLetter as string) > >> > >> ... retrieve and insert ... > >> ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & > >> Left$(FirstLetter,1) & "*'";) > >> > >> ... > >> End Sub > >> > >> > >> 2. Create a method for calling this macro, specifying the argument. You > >> could use 26 separate macros, eg -- > >> > >> Sub GetNames_L() > >> GetNames("L") > >> End Sub > >> > >> etc > >> > >> ... but you might want to play around with this. There are many other > >> options for user input; eg a userform and an input box. > >> > >> > >> > >> > >> > >> <amod.kumar29[ at ]gmail.com> wrote in message > >> news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com... > >> > Is Any one can tell me about this. > >> > > >> > I have to fetch data from MS-Access into word document by pressing a > >> > different keystrokes. > >> > > >> > Let here is example wht i have to do... > >> > In open word document When I press keystroke <Alt>+M...it would > >> > retrieve data whose names starts with 'M' from ms-access table ; > >> > similarly if i press <Alt>+L...it would retrieve data whose names > >> > starts with 'L' from ms-access table . > >> > And how to display these data in word document. I am using macros but > >> > when i create one macro with keystroke other keystroke doesn't work. > >> > > >> > Can anybody solve this problem & guide me how i can get out from this > >> > problem. > >> > > >> > > >> > Thanx....... > >> > > >
|
|
'Binding' has a special meaning in data applications, and I think it's not what you really mean.
"VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message news:1152618427.380378.182260[ at ]s13g2000cwa.googlegroups.com...
[Quoted Text] > Dear Jezebel... > > I want to display data from ms-access into ms-word controls using > keystokes. My query is running accurately but i am not able to bind it > to Label control in word document. > Record is displaying properly when I press keystokes into the MsgBox > but not able to display those records in Label Control. > > expecting u'll give clear solution from urside.... > > thanx ..... > > > Jezebel wrote: >> This gets very messy. Do you really want to bind it, or just read the >> data >> and display it? >> >> >> >> "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message >> news:1152614221.292320.253350[ at ]m73g2000cwd.googlegroups.com... >> > thanx Jezebel >> > >> > How can I bound label control with data from ms-access. >> > >> > >> > >> > >> > >> > Jezebel wrote: >> >> 1. Create a function that retrieves data from your database. The >> >> function >> >> should take an argument -- the letter for which you want to retrieve >> >> data, >> >> eg -- >> >> >> >> Private Sub GetNames(FirstLetter as string) >> >> >> >> ... retrieve and insert ... >> >> ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & >> >> Left$(FirstLetter,1) & "*'";) >> >> >> >> ... >> >> End Sub >> >> >> >> >> >> 2. Create a method for calling this macro, specifying the argument. >> >> You >> >> could use 26 separate macros, eg -- >> >> >> >> Sub GetNames_L() >> >> GetNames("L") >> >> End Sub >> >> >> >> etc >> >> >> >> ... but you might want to play around with this. There are many other >> >> options for user input; eg a userform and an input box. >> >> >> >> >> >> >> >> >> >> >> >> <amod.kumar29[ at ]gmail.com> wrote in message >> >> news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com... >> >> > Is Any one can tell me about this. >> >> > >> >> > I have to fetch data from MS-Access into word document by pressing a >> >> > different keystrokes. >> >> > >> >> > Let here is example wht i have to do... >> >> > In open word document When I press keystroke <Alt>+M...it would >> >> > retrieve data whose names starts with 'M' from ms-access table ; >> >> > similarly if i press <Alt>+L...it would retrieve data whose names >> >> > starts with 'L' from ms-access table . >> >> > And how to display these data in word document. I am using macros >> >> > but >> >> > when i create one macro with keystroke other keystroke doesn't work. >> >> > >> >> > Can anybody solve this problem & guide me how i can get out from >> >> > this >> >> > problem. >> >> > >> >> > >> >> > Thanx....... >> >> > >> > >
|
|
Dear Jazabel, I will make it easier for you to understand my problem. I am very new to VBA but I know working of macros & use of it. But when it comes to retrieve data from Ms-Access on to word document I feel my self very-2 novice. I have an application from where I open Word document on the basis of self made Template other than Normal.dot. I copy my template at runtime & replace Normal.dot. Now My document opens according to my template. Now Use of macros starts from here. I have made Module & write function to access data from MS-Access. When i press key let say <Alt> + M the query is attached to it is fired & retrieve some data from table. when i pass this data in message box it displays proper record. Thing I have to do is to display that data in word document. Only solution i want is that to display record from MS-Acess onto word document at Line first of the document. I hope you will get clear picture of my problem this time.
Thanx
Amod
Jezebel wrote:
[Quoted Text] > 'Binding' has a special meaning in data applications, and I think it's not > what you really mean. > > > > > "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message > news:1152618427.380378.182260[ at ]s13g2000cwa.googlegroups.com... > > Dear Jezebel... > > > > I want to display data from ms-access into ms-word controls using > > keystokes. My query is running accurately but i am not able to bind it > > to Label control in word document. > > Record is displaying properly when I press keystokes into the MsgBox > > but not able to display those records in Label Control. > > > > expecting u'll give clear solution from urside.... > > > > thanx ..... > > > > > > Jezebel wrote: > >> This gets very messy. Do you really want to bind it, or just read the > >> data > >> and display it? > >> > >> > >> > >> "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message > >> news:1152614221.292320.253350[ at ]m73g2000cwd.googlegroups.com... > >> > thanx Jezebel > >> > > >> > How can I bound label control with data from ms-access. > >> > > >> > > >> > > >> > > >> > > >> > Jezebel wrote: > >> >> 1. Create a function that retrieves data from your database. The > >> >> function > >> >> should take an argument -- the letter for which you want to retrieve > >> >> data, > >> >> eg -- > >> >> > >> >> Private Sub GetNames(FirstLetter as string) > >> >> > >> >> ... retrieve and insert ... > >> >> ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & > >> >> Left$(FirstLetter,1) & "*'";) > >> >> > >> >> ... > >> >> End Sub > >> >> > >> >> > >> >> 2. Create a method for calling this macro, specifying the argument. > >> >> You > >> >> could use 26 separate macros, eg -- > >> >> > >> >> Sub GetNames_L() > >> >> GetNames("L") > >> >> End Sub > >> >> > >> >> etc > >> >> > >> >> ... but you might want to play around with this. There are many other > >> >> options for user input; eg a userform and an input box. > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> <amod.kumar29[ at ]gmail.com> wrote in message > >> >> news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com... > >> >> > Is Any one can tell me about this. > >> >> > > >> >> > I have to fetch data from MS-Access into word document by pressing a > >> >> > different keystrokes. > >> >> > > >> >> > Let here is example wht i have to do... > >> >> > In open word document When I press keystroke <Alt>+M...it would > >> >> > retrieve data whose names starts with 'M' from ms-access table ; > >> >> > similarly if i press <Alt>+L...it would retrieve data whose names > >> >> > starts with 'L' from ms-access table . > >> >> > And how to display these data in word document. I am using macros > >> >> > but > >> >> > when i create one macro with keystroke other keystroke doesn't work. > >> >> > > >> >> > Can anybody solve this problem & guide me how i can get out from > >> >> > this > >> >> > problem. > >> >> > > >> >> > > >> >> > Thanx....... > >> >> > > >> > > >
|
|
Well, at least it's clarified that what you're doing is nothing to do with data binding.
I don't understand what you're doing replacing normal.dot. You don't need to do that to create a document using your own template.
As for the rest, do you not like the suggestions already made?
"VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message news:1152681554.164530.56110[ at ]75g2000cwc.googlegroups.com...
[Quoted Text] > Dear Jazabel, > I will make it easier for you to understand my problem. I am very new > to VBA but I know working of macros & use of it. But when it comes to > retrieve data from Ms-Access on to word document I feel my self very-2 > novice. I have an application from where I open Word document on the > basis of self made Template other than Normal.dot. I copy my template > at runtime & replace Normal.dot. Now My document opens according to my > template. Now Use of macros starts from here. I have made Module & > write function to access data from MS-Access. When i press key let say > <Alt> + M the query is attached to it is fired & retrieve some data > from table. when i pass this data in message box it displays proper > record. Thing I have to do is to display that data in word document. > Only solution i want is that to display record from MS-Acess onto word > document at Line first of the document. > I hope you will get clear picture of my problem this time. > > Thanx > > Amod > > > Jezebel wrote: >> 'Binding' has a special meaning in data applications, and I think it's >> not >> what you really mean. >> >> >> >> >> "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message >> news:1152618427.380378.182260[ at ]s13g2000cwa.googlegroups.com... >> > Dear Jezebel... >> > >> > I want to display data from ms-access into ms-word controls using >> > keystokes. My query is running accurately but i am not able to bind it >> > to Label control in word document. >> > Record is displaying properly when I press keystokes into the MsgBox >> > but not able to display those records in Label Control. >> > >> > expecting u'll give clear solution from urside.... >> > >> > thanx ..... >> > >> > >> > Jezebel wrote: >> >> This gets very messy. Do you really want to bind it, or just read the >> >> data >> >> and display it? >> >> >> >> >> >> >> >> "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message >> >> news:1152614221.292320.253350[ at ]m73g2000cwd.googlegroups.com... >> >> > thanx Jezebel >> >> > >> >> > How can I bound label control with data from ms-access. >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > Jezebel wrote: >> >> >> 1. Create a function that retrieves data from your database. The >> >> >> function >> >> >> should take an argument -- the letter for which you want to >> >> >> retrieve >> >> >> data, >> >> >> eg -- >> >> >> >> >> >> Private Sub GetNames(FirstLetter as string) >> >> >> >> >> >> ... retrieve and insert ... >> >> >> ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & >> >> >> Left$(FirstLetter,1) & "*'";) >> >> >> >> >> >> ... >> >> >> End Sub >> >> >> >> >> >> >> >> >> 2. Create a method for calling this macro, specifying the argument. >> >> >> You >> >> >> could use 26 separate macros, eg -- >> >> >> >> >> >> Sub GetNames_L() >> >> >> GetNames("L") >> >> >> End Sub >> >> >> >> >> >> etc >> >> >> >> >> >> ... but you might want to play around with this. There are many >> >> >> other >> >> >> options for user input; eg a userform and an input box. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> <amod.kumar29[ at ]gmail.com> wrote in message >> >> >> news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com... >> >> >> > Is Any one can tell me about this. >> >> >> > >> >> >> > I have to fetch data from MS-Access into word document by >> >> >> > pressing a >> >> >> > different keystrokes. >> >> >> > >> >> >> > Let here is example wht i have to do... >> >> >> > In open word document When I press keystroke <Alt>+M...it would >> >> >> > retrieve data whose names starts with 'M' from ms-access table ; >> >> >> > similarly if i press <Alt>+L...it would retrieve data whose names >> >> >> > starts with 'L' from ms-access table . >> >> >> > And how to display these data in word document. I am using macros >> >> >> > but >> >> >> > when i create one macro with keystroke other keystroke doesn't >> >> >> > work. >> >> >> > >> >> >> > Can anybody solve this problem & guide me how i can get out from >> >> >> > this >> >> >> > problem. >> >> >> > >> >> >> > >> >> >> > Thanx....... >> >> >> > >> >> > >> > >
|
|
I would strongly recommend not replacing people's normal.dot template.
Take a look at this article
Distributing macros to other users http://www.word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm
-- Regards Jonathan West - Word MVP www.intelligentdocuments.co.uk Please reply to the newsgroup Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
"VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message news:1152681554.164530.56110[ at ]75g2000cwc.googlegroups.com...
[Quoted Text] > Dear Jazabel, > I will make it easier for you to understand my problem. I am very new > to VBA but I know working of macros & use of it. But when it comes to > retrieve data from Ms-Access on to word document I feel my self very-2 > novice. I have an application from where I open Word document on the > basis of self made Template other than Normal.dot. I copy my template > at runtime & replace Normal.dot. Now My document opens according to my > template. Now Use of macros starts from here. I have made Module & > write function to access data from MS-Access. When i press key let say > <Alt> + M the query is attached to it is fired & retrieve some data > from table. when i pass this data in message box it displays proper > record. Thing I have to do is to display that data in word document. > Only solution i want is that to display record from MS-Acess onto word > document at Line first of the document. > I hope you will get clear picture of my problem this time. > > Thanx > > Amod > > > Jezebel wrote: >> 'Binding' has a special meaning in data applications, and I think it's >> not >> what you really mean. >> >> >> >> >> "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message >> news:1152618427.380378.182260[ at ]s13g2000cwa.googlegroups.com... >> > Dear Jezebel... >> > >> > I want to display data from ms-access into ms-word controls using >> > keystokes. My query is running accurately but i am not able to bind it >> > to Label control in word document. >> > Record is displaying properly when I press keystokes into the MsgBox >> > but not able to display those records in Label Control. >> > >> > expecting u'll give clear solution from urside.... >> > >> > thanx ..... >> > >> > >> > Jezebel wrote: >> >> This gets very messy. Do you really want to bind it, or just read the >> >> data >> >> and display it? >> >> >> >> >> >> >> >> "VBANovice" <amod.kumar29[ at ]gmail.com> wrote in message >> >> news:1152614221.292320.253350[ at ]m73g2000cwd.googlegroups.com... >> >> > thanx Jezebel >> >> > >> >> > How can I bound label control with data from ms-access. >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > Jezebel wrote: >> >> >> 1. Create a function that retrieves data from your database. The >> >> >> function >> >> >> should take an argument -- the letter for which you want to >> >> >> retrieve >> >> >> data, >> >> >> eg -- >> >> >> >> >> >> Private Sub GetNames(FirstLetter as string) >> >> >> >> >> >> ... retrieve and insert ... >> >> >> ... SELECT [Name] FROM MyTable WHERE ([Name] like '" & >> >> >> Left$(FirstLetter,1) & "*'";) >> >> >> >> >> >> ... >> >> >> End Sub >> >> >> >> >> >> >> >> >> 2. Create a method for calling this macro, specifying the argument. >> >> >> You >> >> >> could use 26 separate macros, eg -- >> >> >> >> >> >> Sub GetNames_L() >> >> >> GetNames("L") >> >> >> End Sub >> >> >> >> >> >> etc >> >> >> >> >> >> ... but you might want to play around with this. There are many >> >> >> other >> >> >> options for user input; eg a userform and an input box. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> <amod.kumar29[ at ]gmail.com> wrote in message >> >> >> news:1152601508.527021.213080[ at ]m79g2000cwm.googlegroups.com... >> >> >> > Is Any one can tell me about this. >> >> >> > >> >> >> > I have to fetch data from MS-Access into word document by >> >> >> > pressing a >> >> >> > different keystrokes. >> >> >> > >> >> >> > Let here is example wht i have to do... >> >> >> > In open word document When I press keystroke <Alt>+M...it would >> >> >> > retrieve data whose names starts with 'M' from ms-access table ; >> >> >> > similarly if i press <Alt>+L...it would retrieve data whose names >> >> >> > starts with 'L' from ms-access table . >> >> >> > And how to display these data in word document. I am using macros >> >> >> > but >> >> >> > when i create one macro with keystroke other keystroke doesn't >> >> >> > work. >> >> >> > >> >> >> > Can anybody solve this problem & guide me how i can get out from >> >> >> > this >> >> >> > problem. >> >> >> > >> >> >> > >> >> >> > Thanx....... >> >> >> > >> >> > >> > >
|
|
|