473,499 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with using query results

I have an access 2002 database which I am having trouble with.
Basically I run a select query which results in a result of "yes" or
"no". I need that result to be put into an update query. I am lost on
this.

Here's the VBA:

Dim strSQL As String
Dim strSQL2 As String

strSQL = "SELECT Hosp_Network.[HUM/CHC_Par]FROM Hosp_Network INNER
JOIN Hosp_Name " & _
"ON Hosp_Network.HumID = Hosp_Name.HumID WHERE (((Hosp_Name.Name)='"
& List71 & "'))"

strSQL2 = "Update testfile set HUM/CHC_Par = '" & strSQL & "' where
HospitalName = ' " & Me.Combo0.Value & " ' "
DoCmd.RunSQL strSQL2

I checked the queries and they both work but there's something simple
I'm missing. The table "hosp_network" contains the field "HUM/CHC Par"
which is either empty or "Yes".

Thanks a lot!!! I am stuck on this one.

Andrew

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
1 1296
The Query Design view in Access is a wonderful thing. I'd copy this SQL
into a query form, put some dummy values in for List71 and Me.Combo0.Value.

If the update query works there, then the problem may be with the contents
of the listBox or comboBox.

"SELECT [HUM/CHC_Par] FROM Hosp_Network INNER JOIN Hosp_Name ON
Hosp_Network.HumID = Hosp_Name.HumID WHERE Hosp_Name.Name = ' " & List71 &
" ' "

"UPDATE testfile SET [HUM/CHC_Par] = ' " & strSQL & " ' WHERE HospitalName =
' " & Me.Combo0.Value & " ' "


Darryl Kerkeslager
"Andrew Slentz" <aj******@yahoo.com> wrote:
strSQL = "SELECT Hosp_Network.[HUM/CHC_Par]FROM Hosp_Network INNER
JOIN Hosp_Name " & _
"ON Hosp_Network.HumID = Hosp_Name.HumID WHERE (((Hosp_Name.Name)='"
& List71 & "'))"

strSQL2 = "Update testfile set HUM/CHC_Par = '" & strSQL & "' where
HospitalName = ' " & Me.Combo0.Value & " ' "


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1868
by: ChaosKCW | last post by:
Hi Using Python 2.4 I am trying to procduce a generator which will return the results of dbi SQL statement using fetchmany for performance. So instead of fetching one record for each call, I...
8
4021
by: Alfonso Esteban Gonzalez Sencion | last post by:
I am trying to use Access as a front end for extracting information from an Oracle database. I started using linked tables but I am getting a very curious behaviour. When I consult the linked...
6
6488
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
3
4600
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
20
2467
by: Development - multi.art.studio | last post by:
Hello everyone, i just upgraded my old postgres-database from version 7.1 to 7.4.2. i dumped out my 7.1 database (with pg_dump from 7.1) as an sql-file with copy-commands and to one file using...
2
2607
by: Arsalan Ahmad | last post by:
Hi, May be I am a newbie, or may be i dont have that much insight in following systems ..i.e. why i have some confusions as below: In many websites, when search is performed on some keywords...
5
2744
by: PHPBABY3 | last post by:
Hi, 1. I have two SQL tables. I will call them employees and departments: EMP: LAST_NAME, FIRST_NAME, DEPTNM DEPT: NUM, NAME Input: text string FIND Output: the LAST_NAME, FIRST_NAME...
9
5741
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
2
2159
by: RoomfulExpress | last post by:
The only problem I'm having with this code is when there are no values returned for the query, it is still allowing you to see and click the 'Next>>'. It disappears when there is at least one return...
10
1656
by: paul814 | last post by:
I am having a bit of a problem with some code....can someone give me some suggestions? Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\production \date2.php on line 28 line 28 is...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
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
7174
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,...
1
6894
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
7388
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...
1
4919
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...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.