By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,742 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,742 IT Pros & Developers. It's quick & easy.

Query Drops Data

P: n/a
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)...the 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
Share this Question
Share on Google+
4 Replies


P: n/a

"Joe-Paul" <Ha*********@comcast.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)...the 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

P: n/a
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******************************@arkansas.net ...

"Joe-Paul" <Ha*********@comcast.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)...the

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

P: n/a

"Joe-Paul" <Ha*********@comcast.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

P: n/a
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...rather 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********@comcast.net> wrote in message
news:Ga******************************@comcast.com. ..

"Joe-Paul" <Ha*********@comcast.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 discussion thread is closed

Replies have been disabled for this discussion.