473,397 Members | 2,116 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,397 software developers and data experts.

ODBC connection

ddtpmyra
333 100+
I very new on Access scripting and I wanted to add on my event like load report and odbc connection so I can execute sql query besides the query attach on the said report.

thanks
Jun 27 '08 #1
4 1887
Stewart Ross
2,545 Expert Mod 2GB
Hi, and welcome to Bytes. Could you give some more detail of what it is you are asking us to help you with? Is it the use of custom events, for example? We need a question to be clearly stated so that we can avoid guesswork which would not help you or those who are trying to answer your question!

There are Posting Guidelines on how to ask a question in this forum which I would ask you to read - linked here for ease of access.

-Stewart
Jun 28 '08 #2
ddtpmyra
333 100+
I establish the link of tables inside the access already using the access wizard, I want to do the select query inside on load event (report or form) where it will supply all the information on its equivalent field.

how to do hardcoding?
Jun 30 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
There is still very little information in your post. However, to answer what I think you are asking, you can set the recordsource of the current form to SQL built as a string value within the On Load event of the form like this - bearing in mind that I do not know the names of your linked tables or their fields, nor how many tables you want to use in your code, so I cannot use real field and table names in the example below:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL as String
  2. strSQL = "SELECT [field1], [field2], ... , [fieldn] "
  3. strSQL = strSQL & " FROM [linked table] INNER JOIN [another table] "
  4. strSQL = strSQL & " ON [linked table].[some field] = [another table].[some field];"
  5. Me.Recordsource = strSQL
The Me operator is a shorthand way of referring to the current form in this case.

I would advise building Access queries using the query editor and using these as the record source for your form instead. You can also assign the relevant query dynamically as the recordsource for your form in the On Load event if you wish, like this

Expand|Select|Wrap|Line Numbers
  1. IF somecondition THEN
  2.   Me.Recordsource = "[Query1]"
  3. else
  4.   Me.Recordsource = "[Query2]"
  5. end if
-Stewart
Jun 30 '08 #4
ddtpmyra
333 100+
Hi Stewart,

thanks for looking into this, but i cannot use the 'me.recordset' because I have query set on the report properties already.

During the event 'on load' i want to run a additional hard coded 'select query' and assigned it on a txt field.

Please help for the script.

thanks!
Jul 3 '08 #5

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

Similar topics

0
by: Sean Anderson | last post by:
ODBC under System DSN Setup Access Driver give it the DSN (Data Source Name) MSA Click on Select and point to the myfile.mdb (your database file)
5
by: SerGioGio | last post by:
Hello, I am going nuts. I am trying to connect to my local ORACLE instance using ODBC. It used to work few weeks ago, but it fails now. Connection with: - SQL*plus: connection works! -...
11
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
14
by: jj | last post by:
Is it possible to call a remote php script from within Access? I'm thinking something like: DoCMD... http://www.domain.com/scripts/dataquery.php DoCmd.OpenQuery "update_data", acNormal, acEdit...
5
by: Alec | last post by:
Hi All, I am currently trying to link in Access 97 to a table in a MSSQL 7 server. Initially the link is fine, however, when I close the access database and re-open it from the same network...
1
by: Paul | last post by:
Hello, I am converting an Access database on our network to a sql 2000 backend and keeping access as the front end. The access database has evolved and been a solution to collect data but now...
4
by: Dave | last post by:
Hey guys, I have an ODBC problem that has me stumped. I wrote a VBA script to run in Microsoft Excel that pulls data out of an application using that application's ODBC driver and puts it into...
9
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
2
by: 111mike | last post by:
Hello, Here's my problem. I cannot connect to mysql database using odbc string connections or dns. I keep getting a "cannot connect to mysql server localhost." I'm running windows XP Pro and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.