473,395 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Trouble with A97 query syntax...

MLH
SELECT tblVehicleJobs.SerialNum
FROM tblOwners RIGHT JOIN tblVehicleJobs ON tblOwners.OwnerID =
tblVehicleJobs.OwnerID
WHERE (((tblVehicleJobs.SerialNum) Like "i*"));

The SQL above lists the rows I want (all vehicles whose VIN begins
with the letter "i"). The SQL below does not produce the rows when
I type the letter "i" into [FirstCharOfVIN] control on form named
frmDMV1stLttr_Type_Other.

SELECT tblVehicleJobs.SerialNum
FROM tblOwners RIGHT JOIN tblVehicleJobs ON tblOwners.OwnerID =
tblVehicleJobs.OwnerID
WHERE
(((tblVehicleJobs.SerialNum)=[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN]
& "*"));
Can someone help me with this query-by-form? What I was hoping is that
[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN] & "*" would evalu-
ate to "i*" (as in the first query - which works).
Nov 13 '05 #1
5 1190
MLH
Further testing shows the following SQL syntax fails to produce the
desired rows as well. Still struggling with the problem. This may shed
some light on it...

SELECT tblVehicleJobs.SerialNum
FROM tblOwners RIGHT JOIN tblVehicleJobs ON tblOwners.OwnerID =
tblVehicleJobs.OwnerID
WHERE (((tblVehicleJobs.SerialNum)="i" & "*"));

Nov 13 '05 #2
MLH
I will use the following work-around, but I am still curious why
the 2 queries in the original post do not return the same dynaset.

Work-around...
SELECT tblVehicleJobs.SerialNum, Left$([SerialNum],1) AS VIN1stChar
FROM tblOwners RIGHT JOIN tblVehicleJobs ON tblOwners.OwnerID =
tblVehicleJobs.OwnerID
WHERE
(((Left$([SerialNum],1))=[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN]));

Nov 13 '05 #3
MLH wrote:
WHERE (((tblVehicleJobs.SerialNum) Like "i*"));

WHERE
(((tblVehicleJobs.SerialNum)=[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN]
& "*"));


There's the difference. If you change the = in the second to Like,
you'll be fine, ie,

WHERE
(((tblVehicleJobs.SerialNum) like
[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN]
& "*"))

The way you had it, would be the same as if you wrote the query for "i" as:

WHERE (((tblVehicleJobs.SerialNum) = "i*"))

In other words, it was looking for serial numbers that were two
characters long, and were and I and an asterisk.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #4
I don't know exactly how you're using this SQL, but I do know that after
executing this line:
MyStr="WHERE tblVehicleJobs.SerialNum LIKE " &
[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN] & "*"

MyStr will read like this:
WHERE tblVehicleJobs.SerialNum LIKE i*
NOT
WHERE tblVehicleJobs.SerialNum LIKE "i*"

So you might want to look at concatenating some quotes in there...

"MLH" <CR**@NorthState.net> wrote in message
news:pu********************************@4ax.com...
SELECT tblVehicleJobs.SerialNum
FROM tblOwners RIGHT JOIN tblVehicleJobs ON tblOwners.OwnerID =
tblVehicleJobs.OwnerID
WHERE (((tblVehicleJobs.SerialNum) Like "i*"));

The SQL above lists the rows I want (all vehicles whose VIN begins
with the letter "i"). The SQL below does not produce the rows when
I type the letter "i" into [FirstCharOfVIN] control on form named
frmDMV1stLttr_Type_Other.

SELECT tblVehicleJobs.SerialNum
FROM tblOwners RIGHT JOIN tblVehicleJobs ON tblOwners.OwnerID =
tblVehicleJobs.OwnerID
WHERE
(((tblVehicleJobs.SerialNum)=[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOf
VIN] & "*"));
Can someone help me with this query-by-form? What I was hoping is that
[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN] & "*" would evalu-
ate to "i*" (as in the first query - which works).

Nov 13 '05 #5
MLH
Yes. You were correct. Thx much!
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

MLH wrote:
WHERE (((tblVehicleJobs.SerialNum) Like "i*"));

WHERE
(((tblVehicleJobs.SerialNum)=[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN]
& "*"));


There's the difference. If you change the = in the second to Like,
you'll be fine, ie,

WHERE
(((tblVehicleJobs.SerialNum) like
[Forms]![frmDMV1stLttr_Type_Other]![FirstCharOfVIN]
& "*"))

The way you had it, would be the same as if you wrote the query for "i" as:

WHERE (((tblVehicleJobs.SerialNum) = "i*"))

In other words, it was looking for serial numbers that were two
characters long, and were and I and an asterisk.


Nov 13 '05 #6

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

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
0
by: David McCowan | last post by:
Have a problem with this query, when xBatch is empty or at least seems to be empty. Using DWMX, MySQL, and PHP SELECT donations.id, donations.batch, donations.oikos_id, donations.giftDate,...
14
by: bolidev | last post by:
I'm new to SQL and can't figure out how to update my table (StoreItemStatus) that contains the current status for items in each store (STORE_KEY, ITEM_KEY, STATUS,...). I get updated status info...
2
by: bob | last post by:
Could someone help me get the following SQL statement working? SELECT standardgame.gamename, standardgame.rowteamname, standardgame.colteamname, standardgame.dollarvalue, standardgame.gameid,...
5
by: Bernie V | last post by:
Hi group, I'm trying to use a DataReader but I get an error. This is my code: private void Page_Load(object sender, System.EventArgs e) { SqlConnection oCon = new...
0
by: Gabriel | last post by:
Hello, I have a connection (server explorer), connected to "AdventureWorks" database, the connection is ok. I drop a table a page (design). I want to configure datasource by click on...
12
by: Todd Michels | last post by:
Hi all, I am trying to send data from a form and insert it into a MSSQL DB. When I submit the data I get: Warning: mssql_query() : message: The name "Todd" is not permitted in this context....
30
by: DH22 | last post by:
Access 03 I'm currently having an issue using Dlookup when trying to reference a query (criteria syntax) Currently I have 1 table, which is L_Emps (which contains Employee_ID as my key...
10
by: Anthony97 | last post by:
This is a problem I've been fighting through for the last month. I've been tasked with converting access 2007 queries to SQL Server 2005. I have been able to convert a number of queries associated...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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,...

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.