I'm hoping someone can help me here.
I'm having problems using a function to get the search criteria for a
column in the QBE grid. The column's data type is Long and the
problem is that if I want to search on more than one value my function
in the QBE correctly returns "1 Or 4" (for example), but something's
getting garbled and I'm not getting the same data back if I just enter
"1 Or 4" (w/o quotes) in the QBE grid.
My guess is that my function is returning a string and so that's
what's used in the QBE. I tried returning a Variant and I tried a
bunch of other stuff --- but nothing's worked!
Any suggestions would be greatly appreciated.
-id 4 3371
Try using "In(1,4)" as the criteria, without the quotes, of course.
Larry Linson
Microsoft Access MVP
"i. dzhugashvili" <id***********@ hotmail.com> wrote in message
news:13******** *************** ***@posting.goo gle.com... I'm hoping someone can help me here.
I'm having problems using a function to get the search criteria for a column in the QBE grid. The column's data type is Long and the problem is that if I want to search on more than one value my function in the QBE correctly returns "1 Or 4" (for example), but something's getting garbled and I'm not getting the same data back if I just enter "1 Or 4" (w/o quotes) in the QBE grid.
My guess is that my function is returning a string and so that's what's used in the QBE. I tried returning a Variant and I tried a bunch of other stuff --- but nothing's worked!
Any suggestions would be greatly appreciated.
-id
Hi Larry,
Thanks for your suggestion.
If I enter "In(1,4)" (w/o quotes) in the QBE grid it works fine of
course. If I try to return this value in the function used in the
grid I get one of two errors:
#1. If I return "In(1,4)" (with quotes) in my function as a String
or Variant, my query returns nothing.
#2. If I attempt to return "In(1,4)" (w/o quotes) I get a compile
error on my function because it doesn't know what to do with the In()
function. I tried specifying different return types for the function
(I was hopeful that Variant would help me out) but no luck.
Any other ideas?
thanks
-Jay
"Larry Linson" <la**********@n tpcug.org> wrote in message news:<6V******* **********@nwrd dc02.gnilink.ne t>... Try using "In(1,4)" as the criteria, without the quotes, of course.
Larry Linson Microsoft Access MVP
"i. dzhugashvili" <id***********@ hotmail.com> wrote in message news:13******** *************** ***@posting.goo gle.com... I'm hoping someone can help me here.
I'm having problems using a function to get the search criteria for a column in the QBE grid. The column's data type is Long and the problem is that if I want to search on more than one value my function in the QBE correctly returns "1 Or 4" (for example), but something's getting garbled and I'm not getting the same data back if I just enter "1 Or 4" (w/o quotes) in the QBE grid.
My guess is that my function is returning a string and so that's what's used in the QBE. I tried returning a Variant and I tried a bunch of other stuff --- but nothing's worked!
Any suggestions would be greatly appreciated.
-id
Create a dummy query, and modify the query SQL as necessary. Then
save the query and finally run it.
Function MySQLStatement( Arg1, Arg2,Arg3...) <--- use an array?
dim strSQL as string
dim intCounter as integer
for intCounter = 1 to ubound(paramArr ay)
strSQL = "SELECT T1.F1, T1.F2... FROM T1 WHERE " &
paramArray(intc ounter) & " AND "
next intCounter
strSQL = LEft$(strSQL,le n$(strSQL)-5 'removes the ' AND '
strsql = strsql & ";"
End function
assuming that big mess works, you can then do something like modify
the SQL of a stored holder query.
dim qdf as querydef
set qdf=currentdb.q uerydefs("qryHo lder")
qdf.SQL = MySQLStatement( ...)
qdf.Save
then you could do something like
Docmd.openquery "qryHolder"
Thanks Larry, I'll certainly give it a try.
-id
"Larry Linson" <la**********@n tpcug.org> wrote in message news:<AH******* **********@nwrd dc01.gnilink.ne t>... Yes. You can create the string containing the SQL (that's what SQL is, a string of text to be interpreted by the database engine) and store it in a public variable or in a field on a form ahead of time and pick it up in the Report's Open event and replace the RecordSource. (The Report's Open event is the only event that allows you to replace the Record Source.)
Larry Linson Microsoft Access MVP
"i. dzhugashvili" <id***********@ hotmail.com> wrote in message news:13******** *************** ***@posting.goo gle.com... That's a good suggestion Pieter and I would have tried it except I ended up modifying my function a little bit to return a Where criteria which I applied to a DoCmd.OpenRepor t call. It seems to be working.
I usually don't use queries in Access except I wanted to use it as the data source for a report. The report designer in Access is great. Do you know if I can use your technique to create a query that can be used as the data source for a report? How would bind the columns in the query with fields in the report?
thanks again -id
pi********@hotm ail.com (Pieter Linden) wrote in message news:<bf******* *************** ****@posting.go ogle.com>... Create a dummy query, and modify the query SQL as necessary. Then save the query and finally run it.
Function MySQLStatement( Arg1, Arg2,Arg3...) <--- use an array? dim strSQL as string dim intCounter as integer
for intCounter = 1 to ubound(paramArr ay) strSQL = "SELECT T1.F1, T1.F2... FROM T1 WHERE " & paramArray(intc ounter) & " AND " next intCounter
strSQL = LEft$(strSQL,le n$(strSQL)-5 'removes the ' AND '
strsql = strsql & ";"
End function
assuming that big mess works, you can then do something like modify the SQL of a stored holder query.
dim qdf as querydef set qdf=currentdb.q uerydefs("qryHo lder") qdf.SQL = MySQLStatement( ...) qdf.Save
then you could do something like Docmd.openquery "qryHolder"
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Snake |
last post by:
I have a vb .net program which fills a data grid upon form load from an
acccess database. This works great. Now, I have to add a combo box and use
it to alter the underlying sql statement and re-fill the data grid. I have
never done this before, but I created a new sql statement in strSql from the
combobox, update the data adapter, and try...
|
by: john |
last post by:
Relatively new to C coding, so any help would greatly be appreciated.
I'm having problems try to return my string array from my parsing
function. When I do a printf I am getting the correct value for my first
element but my subsequent printf's will return garbage. Can someone let
me know what I am doing wrong. Thanks in advance.
-jlewis
|
by: Martin Montgomery |
last post by:
I have, for example, a property called myProperty. I would like, when using a property grid to display the property name as "My Property". Is this possible. Is there an attribute etc
Thank
Martin
|
by: VM |
last post by:
If I wanted to load an ascii file (which contains 400,000+ lines and each
line is a table row) to a datatable and then display it to a datagrid, what
would the best approach be? I initially had a method that would fill the
table with the ascii file data (the parm was the fileName), it would return
the filled datatable, and then I'd use it as a...
|
by: IGotYourDotNet |
last post by:
I'm pulling data out of an oracle db and populating a datagrid such as this
cars doors Cylinders
chevy 4 6
ford 2 8
how can i make it such as
cars chevy ford
cylinder 6 8
| |
by: phil-news-nospam |
last post by:
Is there really any advantage to using DIV elements with float style
properies, vs. the old method of TABLE and TR and TD?
I'm finding that by using DIV, it still involves the same number of
elements in the HTML to get everything just right. When you consider
the class attribute on the DIV elements, there's not much size savings
anymore...
|
by: I.M. !Knuth |
last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until
I started goofing around with this:
================================================================================
/* A function that returns a pointer-of-arrays to the calling function. */
#include <stdio.h>
int *pfunc(void);
|
by: MikeCS |
last post by:
Hi all
I would like some help with this issue. I am new to VB 2005 (OK with VB6)
My problem is that I cannot seem to return a structure from a function.
Example:
I defined a structure in a class (from which I instantiated an object).
One of the object methods is supposed to return a data record (a structure).
|
by: Googy |
last post by:
Hi!!
Can any one explain me the meaning of following notations clearly :
1. typedef char(*(*frpapfrc()))();
frpapfrc f;
2. typedef int (*(arr2d_ptr)());
arr2d_ptr p;
3. typedef int (*(*(*ptr2d_fptr)()))();
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |