473,513 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing result from query to a message box

5 New Member
I have a query created in the queries area that returns a aggregate value (a count() function).
It works if I click on it and provide a value in the prompt.
In a seperate form I want to display the result of this query.

I have tried
C1=Qry_Test!expr1000
C1=[Qry_test]![expr1000}


neither works,

Thanks
Jan 18 '08 #1
6 3178
jaxjagfan
254 Recognized Expert Contributor
I have a query created in the queries area that returns a aggregate value (a count() function).
It works if I click on it and provide a value in the prompt.
In a seperate form I want to display the result of this query.

I have tried
C1=Qry_Test!expr1000
C1=[Qry_test]![expr1000}


neither works,

Thanks
In an unbound textbox use =dsum("[expr1000]","Qry_test") for the textbox rowsource. If its bound to the query just use a textbox and bind the column.
Jan 18 '08 #2
mhnaccess
5 New Member
I need to use the returned value in a test , would this work?
c1=dsum("[expr1000]","Qry_test")
if c1> 10 then

do something
endif

Thanks
Jan 18 '08 #3
mhnaccess
5 New Member
I encounter data type mismatch on c1 = DSum("[expr1000]", "Qry_test")
with c1 declared as integer

Mike
Jan 18 '08 #4
mhnaccess
5 New Member
OK,
I have the correct method,

DSUM led me to Dcount which is

c1=c1 = DCount("*", "Table name", "[field name]=' something' ")
Jan 18 '08 #5
jaxjagfan
254 Recognized Expert Contributor
Declare C1 as a Double or Long and try again.

What value is the query returning?
Jan 18 '08 #6
prasenjitSG
1 New Member
Hi,
I am trying to develop a php page where user can write mysql query (select, insert, update) and run.

I have developed one for select query. here is the code:
<?
/***************************
* Author: P. Sengupta
* Used for Admin Utility only
***************************/
?>
<br>
<h2>Run SELECT Query</h2>
<?
$query=$_POST["query"];
?>

<form action="#" method="post">
<textarea name="query" cols="80" rows="10">
<?=$query?>
</textarea>
<br>
<input type="submit" value="Submit" /> <input type="reset" value="Reset" />
</form>

<?php

if (empty($query)) {
echo "<br>Enter query...";
exit;
}
else {
$q = str_replace (" ", "", $query);
if (string_begins_with(strtoupper($q), 'SELECT')) {}
else {
echo "<font color=red>Sorry! Only SELECT statement is allowed. The query expression you entered does not seem like a SELECT statement...</font>";
exit;
}
}
//echo "here....";
include 'config.php';
//$query=" select * from store_items ";
getDBLink();
$result = mysql_query($query);
if (mysql_errno()) {
echo "<font color=red>MySQL error ".mysql_errno().": ".mysql_error()."</font>";
exit;
}
if (!$result) {
echo "No result found... Check the query...</font>";
exit;
}
$num = mysql_num_rows ($result);
if ($num==0) {
echo "<font color=red>Zero records found</font>";
exit;
}
else {
echo "<font color=blue>$num records found.</font><br>";
}

$fields = mysql_num_fields($result);
echo "<table cellspacing=1 cellpadding=2 bgcolor=#000000><tr bgcolor=#cccccc>";
for($count=0;$count<$fields;$count++) {
$field = mysql_fetch_field($result,$count);
echo "<td>$field->name <br>($field->type)</td>";
}
echo "</tr>";
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
echo "<tr bgcolor=#ffffff>";
for($count=0;$count<$fields;$count++) {
echo "<td>$row[$count] &nbsp;</td>";
}
echo "</tr>";
}
mysql_close();
echo "</table>";

function string_begins_with($string, $search)
{
return (strncmp($string, $search, strlen($search)) == 0);
}

?>

Now I want to modify this page for working all three (select, insert and update) quires together. can anybody please help me??
MY mail id : prasenjitsengupta2005@gmail.com
Sep 12 '10 #7

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

Similar topics

1
7770
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
3
2069
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed...
3
16928
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
5
3551
by: Tim Menninger | last post by:
I have seen the postings about passing XML into an XSL transformation. The problem is that I cannot use any XPath navigation in the XSL that won't generate an error. If I use <xsl:copy-of...
6
2336
by: JackM | last post by:
I have a multiple select input in a form that's being populated by a row from my database as such: <input type=\"checkbox\" name=\"subm\" value=\"$row\"> That part is working fine as I can check...
0
2406
by: kencana | last post by:
hi All, I got problem in passing data (more than one) from soap client to the soap server. but if i only passing one data at a time, it works successfully.. The following is the error message i...
11
3741
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result =...
6
2618
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect...
1
1285
Chrisjc
by: Chrisjc | last post by:
First off here is the link to my page Link to page I am having an issue passing the "State" value to "dealerlocater.php" page that I have created, I have my index.php which will pull from my...
9
1531
by: JRough | last post by:
I'm getting the error message that the parameter passed to the function is not a valid resource. The parameter is $result and it is from a query in a switch statement. What do I have to do to get...
0
7158
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
7380
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
7098
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
7523
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...
0
5683
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,...
1
5085
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
4745
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...
0
3232
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...
0
1592
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 ...

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.