473,395 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Access 2003 ADP

3
Using Microsoft 2003 (ADP)connecting to SQL 2000. I am trying to create a simple form in Access and pass parameters to a SQL query.

tried but dosen't work :

SELECT Port_Code, Port_Name
FROM dbo.Port_Code
WHERE [forms!Select_Form![Name]]]

pls help

many thanks
Feb 24 '06 #1
3 5712
First, create a pass-through query, no sql in it, and save it with name (eg. MyPTQuery)

you can fill in the Sql via code:

Sub UDS_Define_Pass_Through_Query()

Dim dbs As Database
Dim qdf As QueryDef
Dim strSql As String

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("MyPTQuery")

' Assuming Select_Form is open and <> design
strSql = _
"SELECT Port_Code, Port_Name " & _
"FROM dbo.Port_Code " & _
"WHERE Port_Name ='" & Forms!Select_Form![Name] & "'"
' single quotes because parameter is a string

qdf.SQL = strSql

Set qdf = Nothing
Set dbs = Nothing

End Sub
Feb 24 '06 #2
Zahed
3
Sorry to be confused. What do you mean by a pass-through query

First, create a pass-through query, no sql in it, and save it with name (eg. MyPTQuery)

you can fill in the Sql via code:

Sub UDS_Define_Pass_Through_Query()

Dim dbs As Database
Dim qdf As QueryDef
Dim strSql As String

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("MyPTQuery")

' Assuming Select_Form is open and <> design
strSql = _
"SELECT Port_Code, Port_Name " & _
"FROM dbo.Port_Code " & _
"WHERE Port_Name ='" & Forms!Select_Form![Name] & "'"
' single quotes because parameter is a string

qdf.SQL = strSql

Set qdf = Nothing
Set dbs = Nothing

End Sub
Feb 27 '06 #3
Ok, let's start from an earlier point...

The Record Source of your form can be a table (linked or local) or a query.

The source of a query can be one or more tables and/or one or more queries.

In this case the Record Source is a query on a linked table since the database of that table is not Access but SQL 2000.

A pass-through query can access this data directly, without the need to link the table.

How:
Create a new query
Choose design view
Choose Close when Access ask you which table(s) / Queries
Open Menu Option "Query"
Choose SQL Specific
Choose Pass-Through
=> as from now, the Design View is not longer available and the screen is switched into SQL View

save it with name (eg. MyPTQuery) :-)
Mar 6 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
2
by: BT Openworld | last post by:
I have just had to upgrade to Access 2003 as Access 97 EMail (SendObject) doesn't work when loaded on Windows XP. I'm finding my way around Access 2003 but my biggest problem is getting...
1
by: Wayne Aprato | last post by:
I have a client who is running several Access 97 databases that I have written for them. They are about to upgrade to Access 2003. Is the default file format of Access 2003 still Access 2000 the...
3
by: Colin Chudyk | last post by:
Hi, Here is my situation. Can anyone provide insight? I have developed a database in Access 2002. I am planning to distribute it as a split MDE (front) / MDB (back) to be used by the Access...
7
by: Wayne Aprato | last post by:
I have several Access 2003 mde databases. When I try to open them in Access 2002 I get the following error: "The Visual Basic for Applications project in the database is corrupt." ...
2
by: Jeff | last post by:
Does anyone know of any potential problems running a 2000 database with 2003? Also, what about installing all other Office products as 2003 versions but leaving Access as 2002 running a 2000...
10
by: Lauren Wilson | last post by:
Ok I have searched the MS website for info on this. I am totally confused. If I want to deploy an Access 2003 app and allow my users to run it using Access 2003 Runtime, where do I get the...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
49
by: Mell via AccessMonster.com | last post by:
I created databases on Access 2003 and I want to deploy them to users. My code was also done using 2003. If they have Ms Access 2000 or higher, will they be able to use these dbs with all code,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.