473,799 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query Drops Data

Hi:

I'm running a simple query on an Access Table from VB6.0. The operator can
make several different selections. Based on their selection, a different,
specific SQL needs to be run. So, when the operator says... "Do it"...the
click procedure goes to a Function (based on their selection)...th e specific
function builds the correct SQL and returns it...then it sends that query to
the final procedure to run the sql, retrieve the data and put it on my form.
When I run the program, it returns the data in the first three fields, but
the fourth field is empty...there is data in that field in the table...but
it is not returned. I've checked the SQL that is being passed and it is
being passed correctly.

When I put a "MsgBox SQL" to check out the SQL (after the SQL is developed
and before it is actually run in the final procedure) the SQL is correct and
all of the data is printed on the form (that is when the program pauses and
waits for the operator to click on the message box). When there is no pause
for a message box, the data is not returned...when them message box is
there, the data is returned correctly.

CAn anyone tell me what the heck is happening? And how I might get around
this without having the operator read and close a message box?

Any assistance or suggestion would be helpful.

JP
Mar 25 '06 #1
4 4504

"Joe-Paul" <Ha*********@co mcast.net> wrote in message
news:Sd******** *************** *******@comcast .com...
Hi:

I'm running a simple query on an Access Table from VB6.0. The operator can make several different selections. Based on their selection, a different,
specific SQL needs to be run. So, when the operator says... "Do it"...the
click procedure goes to a Function (based on their selection)...th e specific function builds the correct SQL and returns it...then it sends that query to the final procedure to run the sql, retrieve the data and put it on my form. When I run the program, it returns the data in the first three fields, but
the fourth field is empty...there is data in that field in the table...but
it is not returned. I've checked the SQL that is being passed and it is
being passed correctly.

When I put a "MsgBox SQL" to check out the SQL (after the SQL is developed
and before it is actually run in the final procedure) the SQL is correct and all of the data is printed on the form (that is when the program pauses and waits for the operator to click on the message box). When there is no pause for a message box, the data is not returned...when them message box is
there, the data is returned correctly.

CAn anyone tell me what the heck is happening? And how I might get around
this without having the operator read and close a message box?

Any assistance or suggestion would be helpful.

JP

I think we need to see some code.

It is doubtful your SQL is being affected by the msgbox, it has to be
something in how you are attempting to capture or view the value.

Because the returned values are variants, a msgbox can on occasion affect
displayed results by 'fixing' the value to a specific type. But that is
uncommon and just a wild suggestion on my part.

Review how you are capturing the values of that last field. Doing anything
cute?

-ralph
Mar 27 '06 #2
Hi Ralph:

I have data in one table and each record shows the number of trips taken by
each type of vehicle each day, with dispatch times, arrival times, etc. I
want to compare vehicle type 1's "chunk" of data for a given period of time
with the same vehicle's "chunk" of data a year ago. (Compare Jan 1, 2005 to
Feb 1, 2005 with Jan 1, 2006 to Feb 1, 2006). So I "append" the frist set
of data from table one into table two...then update table two with the info
from an SQL getting the corresponding data for the second part of the
comparison. ONce in the second table, I use another SQL to bring the data
into a datagrid. But when I do that, the first time the process runs, the
second amount of data does not show up in the grid... I refresh it, but that
doesn't change anything. If put a "msgbox" in the procedures just before
the grid is loaded...all data shows...without the "msgbox"... the second half
of the data is dropped.

So...yes, I'm doing some funky things with the data as it is moved to set it
up as I need it for the comparison. Each SQL works right...I've checked
each one in Access..and they work... but when I put them together...the
second part of the data is dropped. (If I try to compare over a three year
period, the first and second year show up...but the third year is
dropped.)..

So... I'll just have to see if I can work around this some way.

Thanks
JP

"Ralph" <nt************ *@yahoo.com> wrote in message
news:de******** *************** *******@arkansa s.net...

"Joe-Paul" <Ha*********@co mcast.net> wrote in message
news:Sd******** *************** *******@comcast .com...
Hi:

I'm running a simple query on an Access Table from VB6.0. The operator

can
make several different selections. Based on their selection, a
different,
specific SQL needs to be run. So, when the operator says... "Do
it"...the
click procedure goes to a Function (based on their selection)...th e

specific
function builds the correct SQL and returns it...then it sends that query

to
the final procedure to run the sql, retrieve the data and put it on my

form.
When I run the program, it returns the data in the first three fields,
but
the fourth field is empty...there is data in that field in the
table...but
it is not returned. I've checked the SQL that is being passed and it is
being passed correctly.

When I put a "MsgBox SQL" to check out the SQL (after the SQL is
developed
and before it is actually run in the final procedure) the SQL is correct

and
all of the data is printed on the form (that is when the program pauses

and
waits for the operator to click on the message box). When there is no

pause
for a message box, the data is not returned...when them message box is
there, the data is returned correctly.

CAn anyone tell me what the heck is happening? And how I might get
around
this without having the operator read and close a message box?

Any assistance or suggestion would be helpful.

JP

I think we need to see some code.

It is doubtful your SQL is being affected by the msgbox, it has to be
something in how you are attempting to capture or view the value.

Because the returned values are variants, a msgbox can on occasion affect
displayed results by 'fixing' the value to a specific type. But that is
uncommon and just a wild suggestion on my part.

Review how you are capturing the values of that last field. Doing anything
cute?

-ralph

Mar 27 '06 #3

"Joe-Paul" <Ha*********@co mcast.net> wrote in message
news:DK******** *************** *******@comcast .com...
Hi Ralph:

So I "append" the frist set of data from table one into table two...then
update table two with the info from an SQL getting the corresponding data for
the second part of the comparison. ONce in the second table, I use another
SQL to bring the data into a datagrid. But when I do that, the first time the
process runs, the second amount of data does not show up in the grid... I
refresh it, but that doesn't change anything. If put a "msgbox" in the
procedures just before the grid is loaded...all data shows...without the
"msgbox"... the second half of the data is dropped.


This is clearly a timing problem, which the msgbox "fixes" by putting in a big
fat delay. It has something to do with the way you are using the grid, not with
SQL or the database. Refreshing does not always mean the same thing as Requery,
and sometimes just means the display is repainted. After you are done with all
data modifications, be certain that you are re-running the query that pulls the
data into the grid.

Mar 28 '06 #4
Thanks Steve:

As I was writing the last note for the board, I realized that all I had to
do was use a cross tab query and that might "fix" the problem...rathe r than
moving the data to a different table...then querrying it... I tried
it...and, by golly, it worked... KISS has always escaped me (Keep it simple
stupid...) :0)...thanks for taking the time to reply.

JP
"Steve Gerrard" <my********@com cast.net> wrote in message
news:Ga******** *************** *******@comcast .com...

"Joe-Paul" <Ha*********@co mcast.net> wrote in message
news:DK******** *************** *******@comcast .com...
Hi Ralph:

So I "append" the frist set of data from table one into table
two...then update table two with the info from an SQL getting the
corresponding data for the second part of the comparison. ONce in the
second table, I use another SQL to bring the data into a datagrid. But
when I do that, the first time the process runs, the second amount of
data does not show up in the grid... I refresh it, but that doesn't
change anything. If put a "msgbox" in the procedures just before the
grid is loaded...all data shows...without the "msgbox"... the second half
of the data is dropped.


This is clearly a timing problem, which the msgbox "fixes" by putting in a
big fat delay. It has something to do with the way you are using the grid,
not with SQL or the database. Refreshing does not always mean the same
thing as Requery, and sometimes just means the display is repainted. After
you are done with all data modifications, be certain that you are
re-running the query that pulls the data into the grid.

Mar 31 '06 #5

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

Similar topics

13
2893
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine. Value selected is used as the 'where' clause of the 2nd query. If $site is a single word, the 2nd query works like a charm. If $site is more than one word (has spaces), the query returns a null
3
2355
by: Andrew Mayo | last post by:
There is something very strange going on here. Tested with ADO 2.7 and MSDE/2000. At first, things look quite sensible. You have a simple SQL query, let's say select * from mytab where col1 = 1234 Now, let's write a simple VB program to do this query back to an MSDE/2000 database on our local machine. Effectively, we'll
1
1626
by: Rose | last post by:
I have an ACCESS 2000 database and I have a table with a field setup as a MEMO. I am trying to run a query and append the MEMO field to another table - everytime I run the query - it drops data - it doesn't append the whole memo field - just part of it. The field I am appending to is also set up as a MEMO. I have other tables that I am also running the same query on and they work fine - but this one does not. Any ideas of what I have...
0
1194
by: Simon Devlin | last post by:
Ok, I realize that this is vague, but I'm stuck :-( I've a particular query that when executed from within asp.net times out (after 30 seconds) If I do it from within the SQL Query Analyzer on the same machine, it works fine (and in general takes < 2 seconds) It's possible that it's connection pool exhaustion - the message that comes up is the usual "timeout. maybe connection could not be allocated...blah...blah", but if I kill the...
5
14773
by: laurentc | last post by:
Dear all, I have several tables based on exactly the same fields (Key/Date/Price1/Price2). I do some statistics on the prices. However, as I have many different tables (the tables are different because I directly import the data from a .csv file), I do not want to create dozens of queries to be able to get the results of the different tables.
5
7573
by: DougieC | last post by:
Hello all. First off, Im not a programmer so I am some what stumbling through this. 8 years of social science education never trained me to handle real world problems, such as figuring out how to develop a Data Base for the military. So a summary of my problem. I am using MySQL, on the suggestion of the higher ups, to combine multi-yeared data into one master table. My logic works like this. Populate a Master Table with unique...
3
1276
by: NCRStinks | last post by:
Hi Every1 Having a slight issue on creating a query to combine 2 queries, this year and last years data. The thing is, I have data for this year for all stores, however on last year I dont for every record. On the "combined" query, it only returns records with both this year and last year data. It "drops" any records without last years data. Is there any way I can make the query return " " rather than null so all records are pulled...
0
1305
by: csin | last post by:
I have an Access DB backend for the application I am running, I want to use the built in ability in Access to remove duplicate entries... Say I have table1 with fields field1 field2 and field3, none of the fields are indexed without duplicates for a reason... The way I remove duplicates is to do an append query into an identical table that has one of the fields set to indexed no duplicates. If I run this query in Access directly I get a...
11
2096
by: msrobotto | last post by:
Hi All, I am using a query to pull records of all files in a given location. The file location is a dropdown list of possible locations: Pending Approval, Pending Correction, Mailed, Paid. I would like to be able to run a report of all files "Pending Approval". I created the Query with the Criteria ="Pending Approval" (exactly as it appears on the data table). If a file's location has not been updated it works fine, but I've noticed that...
0
9540
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10222
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10026
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7564
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
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 we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.