Programmatically creating a pass-through query

Hi,

Is there a way to programmatically create pass-through query in Access 2003?

Sub test ()

    Dim db              As Database
    Dim strSQL          As String
    Dim qdfs            As QueryDefs
    Dim qdf             As QueryDef

    strSQL ="Some pass-through SQL statement here"

    Set db = CurrentDb
    Set qdfs = db.QueryDefs
    Set qdf = db.CreateQueryDef("qry_PassThru", strSQL)
    qdf.SQL = strSQL

End Sub

But the code about will not create a pass-through query, Access thinks 
it is a regular Access query.  Is there a way to specify in code the 
type of query it is?  Thanks for sharing your thoughts.


Ben

0
Ben
5/17/2010 8:18:55 PM
dotnet.languages.vb 830 articles. 0 followers. Follow

2 Replies
1364 Views

Similar Articles

[PageSpeed] 24

Am 17.05.2010 22:18, schrieb Ben:
> Hi,
> 
> Is there a way to programmatically create pass-through query in Access 2003?
> 
> Sub test ()
> 
>     Dim db              As Database
>     Dim strSQL          As String
>     Dim qdfs            As QueryDefs
>     Dim qdf             As QueryDef
> 
>     strSQL ="Some pass-through SQL statement here"
> 
>     Set db = CurrentDb
>     Set qdfs = db.QueryDefs
>     Set qdf = db.CreateQueryDef("qry_PassThru", strSQL)
>     qdf.SQL = strSQL
> 
> End Sub
> 
> But the code about will not create a pass-through query, Access thinks 
> it is a regular Access query.  Is there a way to specify in code the 
> type of query it is?  Thanks for sharing your thoughts.


Even though this is a VB.Net group (which will be dead soon),
the "dbQSQLPassThrough" value should make it:

http://msdn.microsoft.com/en-us/library/bb257317(office.12).aspx


-- 
Armin
0
Armin
5/17/2010 10:11:11 PM
Thanks Armin.

Ben

On 5/17/2010 6:11 PM, Armin Zingler wrote:
> Am 17.05.2010 22:18, schrieb Ben:
>> Hi,
>>
>> Is there a way to programmatically create pass-through query in Access 2003?
>>
>> Sub test ()
>>
>>      Dim db              As Database
>>      Dim strSQL          As String
>>      Dim qdfs            As QueryDefs
>>      Dim qdf             As QueryDef
>>
>>      strSQL ="Some pass-through SQL statement here"
>>
>>      Set db = CurrentDb
>>      Set qdfs = db.QueryDefs
>>      Set qdf = db.CreateQueryDef("qry_PassThru", strSQL)
>>      qdf.SQL = strSQL
>>
>> End Sub
>>
>> But the code about will not create a pass-through query, Access thinks
>> it is a regular Access query.  Is there a way to specify in code the
>> type of query it is?  Thanks for sharing your thoughts.
>
>
> Even though this is a VB.Net group (which will be dead soon),
> the "dbQSQLPassThrough" value should make it:
>
> http://msdn.microsoft.com/en-us/library/bb257317(office.12).aspx
>
>

0
Ben
5/18/2010 2:42:48 PM
Reply:

Similar Artilces:

Creating Sources
I often use online databases to find information for essays and such. Which option would be my best bet to plug in the information properly? I know there IS something to use for journal articles, but those seem to be for print. Can it apply for web versions too? I'm not entirely sure, but I doubt any of the styles that came with Word 2007 add electronic information to journal articles. What Word does is collect all the information you provided for a certain source and pass it along to your style (an xslt file). Your style then takes the bits and pieces it needs, formats th...

sql room booking query
hai, I am Doing room booking .for eg if a user enter the Need from date as 2/10/2010 and Need to 7/10/2010.booked if another user go for booking so i have to check three conditions.for availability. 1)if another user enter 23/09/2010 to 2/10/2010 is nt possible 2)Also datetime shouldnt be between 2/10/2010 and 7/10/2010 3)also from 7/10/2010 to any other date greater than 7/20/2010 nt possible. pls give hw can i write the querry???? vidya (u64122@uwe) writes: > I am Doing room booking .for eg if a user enter the Need from date as > 2/10/2010 > and Need to 7...

crosstab query values
I have a crosstab query that I've created for a Rolling 12 month report. It works great but now I need to add another value to the query. I know that you can only have 1 value field, 1 column field and multiple row fields. My current value field is ShipQty. I need another value field of Price. Is there a way around to get this output? Thanks in Advance Kim P -- Message posted via http://www.accessmonster.com That works, but now my months are not in order. How can I get them to be in chronological order so that they show up correctly on my report. Duane Hookom wrote: >You can poss...

MS Excel creating inventory
I need to keep a running inventory of parts and material furnished to my company by the Government for repair work. Can I integrate barcode scanning and software into MS Excel? I think this would be much less laborious than manually inputting hunreds of items on hundreds of different jobs. Any help greatly appreciated. I did a google search...but not real sure which programs will integrate. ...

Creating own border
Message for Mary. I used Mary's tips from this group a few months ago, which I had saved in my "Publisher Tips Folder". Could you please help? I now use Publisher2007 Publisher2003 I created a border which I am able to Copy/Paste onto a newly created card using Publish2007. All is well and suits my needs. I use this border quite a lot for my Birthday cards for men! However being the person I am, I wanted to have this border in "Created Customs"on my new Publish 2007 OS. Where am I going wrong? I spent at least 3 hours yesterday trying various methods but I am u...

sub query
Does MS Access support sub query? I wanted to create a query which has sub query like following Select MyField, (select MyField1 from mytable1 where mytable1.myfiled2 = mytable.MyField3) from mytable Do I need create 2 queries to do this or just one query with one sub query? Your information is great appreciated, Yes. Access supports subqueries like that. More info and some examples: http://allenbrowne.com/subquery-01.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at ...

Formula Query
I'm hoping someone out there may be able to help with a formula that would be of tremendous help to me. As someone who does a good deal of trading on ebay I use excel 97 to keep a running tab on my profit margins. The problem is I really want it to be more accurate. As ebay charges a final 'Value Fee' based on a percentage of the final sale price, I wanted to know how I could use this in a formula. The fees range as follows: Selling price of �0 - �29.99 - Ebay takes - 5.25% Selling price of �30.00 - �599.99 - Ebay takes - 3.25% Selling price of �600.00 and up - Ebay takes - 1....

CREATE A LAYOUT
I'M TRYING TO SEE IF I CAN USE EXCEL TO CREATE A WAREHOUSE LAYOUT... HOPEFULLY IN ( SD ) CAN ANYONE OFFER ME SOME HELP? OR IS THERE ANOTHER MICROSOFT PROGRAM THAT WILL MEET THIS NEED BETTER! THANKS ...

Where is create new office document command in Office 2007?
We recently migrated to 2007 from 2003 and I cannot find the commands to "create new office document" or "open existing office document" from the taskbar/start menu. Does anyone have any idea where these commands are or how I can add them to my taskbar? Thank you! I have XP Pro and Office 2007. If I select "All Programs", it appears at the top of the list. If you do as well, you can right-click and select Pin to Start Menu. -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "c...

Emailing a form created from a query
I am using Microsft Access 2007 to email a form to individual email addresses so they can update their details and email it back to me. The form was created from a query as the information is in more than one table. However when the recipient gets the email the form is blank and no longer contains the information which was in the form and query. It seems to work when I have created the form from a table but not a query??? ...

How do I create a box plot in Excel?
I am trying to create a box plot in excel. My book says to go to tools and Data Analysis Plus. I have already added data analysis, but I have no Data analysis plus. Can anyone help? That appears to be an Australian third party add-in. (I Googled for that info.) -- JoAnn Paules MVP Microsoft [Publisher] "TEW" <TEW@discussions.microsoft.com> wrote in message news:F7947896-1FA3-4326-9509-11660EB171FC@microsoft.com... >I am trying to create a box plot in excel. My book says to go to tools and > Data Analysis Plus. I have already added data analysis, but I have no D...

CRMContact.Create problem
I have a problem inserting an Contact in CRM. Input: ----------------------------------------------- "<contact><firstname></firstname><middlename></middlename><lastname>Rietdijk</lastname><salutation></salutation><birthdate>03-08-1936 00:00:01</birthdate><emailaddress1></emailaddress1><address1_line1>Dorpsdijk 127</address1_line1><address1_postalcode>3161CA</address1_postalcode><address1_city>Rhoon</address1_city><telephone1>010-5015331</telephone1><fax>010-...

How to create Conditional Formats that "grow" with copy/fill down.
I would like to set up 1 conditional format that will grow as I copy & paste. All I've been able to do is copy the same over & over. I have tried to "paste special - format", but it didn't work. Example: Cell value is: equal to, $F$8, then Font is White. I would like to grow the "$F$8" as I copy & paste. Thanks for ANY help. Try a formula like =A1=$F$8:F8 -- HTH RP (remove nothere from the email address if mailing direct) "AliceNXLand" <AliceNXLand@discussions.microsoft.com> wrote in message news:70AD36AA-FAF1-49E3-8BCF-...

Update Query Randomization
I'm now trying to update some of the data in a table with UPDATE rawdata SET rawdata.[User] = Int((1200-1+1)*Rnd()+1); but it updates all the values to a single random number. Is there a way to make it insert a different random number for each value? The key is called ID Test if this will work: UPDATE rawdata SET rawdata.[User] = Int((1200-1+1)*Rnd()+[USER]); -- Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder. "Ian" wrote: > I'm now trying to update some of the data in a table with > ...

Workflow email when lead is created
I want to have a workflow setup that will send an email based on a template when a lead is created. I get to the point of setting the properties of the email, but I seem to be unable to select a value for the recipient that will send the email to the leads emailaddress1. I would assume I need a dynamic value for the To: field, but for the life of me, I don't see a value in the list that will give me the desired result. Surly this does not require custom code. Please help. thanks 1. select the templete 2. from the "to", select the dynamic value "lead" - which...

Creating A New CFrameWnd
Let's say I have a dialog based application. When the user clicks a button on the dialog, I want to create a new window that looks a lot like Windows Explorer. That is, it's a window that has 2 views separated by a splitter, a menu and toolbar. My question is how do I go about doing this? It seems like a candidate for setting up a new window that supports Doc/View, but I'm not sure how to dynamically create such a beast. Everything I can find talks about creating Doc/View for a new application and this is not what I want. Thanks. Instead of using a dialog app, create an app ...

Pass Parameter to stored procedure in pass thru query
How do I pass a parameter to a stored procedure in a pass thru query? I'd like to enter the parameter in a control on a form and then run the pass thru query and pass the parameter to it. I've tried this, but haven't been successful. Any ideas? Thanks. On Sun, 8 Jul 2007 18:04:26 -0500, "SAC" <sac@somewhere.com> wrote: >How do I pass a parameter to a stored procedure in a pass thru query? > >I'd like to enter the parameter in a control on a form and then run the pass >thru query and pass the parameter to it. > >I've tried this, b...

How do I create a stem and leaf plot on Excel 2003?
A stem and leaf plot is method for easy hand creation of a crude histogram. The Analysis ToolPak contains a histogram tool. The stem and leaf plot differs from a histogram in the following ways: - The histogram is more flexible in choice of boundaries between bars, since the stem and leaf plot always groups by 10's - The stem and leaf plot uses the units digits of the actual numbers like a plot symbol. This gives you the potential of visually evaluating the distribution within a bar. You might be able to nest SMALL() and IF() functions to fake it in workbook cells. The resu...

Programmatically Minimizing my App?
Hi, How can I programmatically Minimizing my App? Thanks, Scott Metzger Try ::ShowWindow( hWnd, SW_SHOWMINIMIZED /* or SW_FORCEMINIMIZE in W2K & XP */ ); -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- "Scott Metzger" <NOSPAMScott.Metzger@york.com> wrote in message news:3F621CDB.2060406@york.com... > Hi, > > How can I programmatically Minimizing my App? > > Thanks, > Scott Metzger > ...

Cannot create New Task
For some reason I have lost the ability to create a new task. The New Task dislog opens and allows me to enter text but when I attempt to Save and Close I get the message 'Could not complete the operation, one or more parameter values are not valid'. Any ideas? ...

Create and Destroy Dialog
Ich can have a problem with destroying an dialog. I use the following code: void CTestPhasePPMDlg::OnBnClickedButtonStartOutput() { if (theApp.m_pDlgPhaseOutput != NULL) { theApp.m_pDlgPhaseOutput->SetForegroundWindow(); theApp.m_pDlgPhaseOutput->SetFocus(); } else { theApp.m_pDlgPhaseOutput = new CDlgPhaseOutput; theApp.m_pDlgPhaseOutput->Create(CDlgPhaseOutput::IDD); // Ausgabe initialisieren theApp.m_pDlgPhaseOutput->ShowWindow(SW_SHOW); } } void CTestPhasePPMDlg::OnBnClickedButtonEndOutput() { if (theApp.m_pDlgPhaseOutput != NULL) { theApp.m_p...

Excel 2000
Hi, I wanted to create an automatic seacrh in MS Excel or MS Access. For example in Column A1, I have "APPLE" and then column "A2" should search for the unit price of APPLE in a database. And then on on cell B1=Orange, B2 should search for the unit price of orange in a database. How do I do that thanks Hi have a look at VLOOKUP for this. See: http://www.contextures.com/xlFunctions02.html -- Regards Frank Kabel Frankfurt, Germany "echo7" <echo7@discussions.microsoft.com> schrieb im Newsbeitrag news:709085ED-2C2A-44A0-9492-42E4CB24DF00@microsoft.com......

Create a Virtual Monitor
I'm new to driver development but have over 15 year experience programming in other areas. I want to create a software like maxivista (http://www.maxivista.com/) . Basically, what it does is create a virtual monitor and sends the video data over network to the client pc...which basically paints it in a window...giving the illusion of a second monitor. I've gone through the DDK and I know mirror driver is Not the solution in this case. So basically, I need to create a virtual video driver. But there is No instruction etc anywhere on how to create one. So how do I go o...

New virtual server always creates ExchWeb
Hi, we have a problem getting OWA to work correctly through our content switch. In our test-domain, we have 2 virtual servers running on the same IIS server, both a unique IP. When you create a new vertual server, a new web is created, and in that new web, Exchange automatically creates a virtual directory called ExchWeb. Is this hardcoded in Exchange 2003? We need to be able to change this in a way, because our content switch (Cisco CSS 1100) routes user requests to 1 destination based on the content. What happens, is that if users connect to the non-https server with url http://som...

creating a worksheet in a worksheet?
Can you select a certain group of rows and columns, then separate tha from the rest of the worksheet? As if it could make its own littl worksheet, so I could edit the # of columns and the sizes of thos columns without it changing the entire worksheet? If so, how do I d that? thanks -- Message posted from http://www.ExcelForum.com Excel Forum user who thinks "skaskaska >" suffices as their name, or even that symbols look okay within name/author field in newsgroups. No. Among other things you cannot change the width of a cell within a column, the entire column must have the s...