473,440 Members | 1,759 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,440 software developers and data experts.

VBA Query code issue........

Hi,

I have the following SQL string, but cannot get it working:

strSQL = "SELECT * FROM [pcbforecast] where [pcbforecast].[JobNumber] =
'" & [Forms]![PCBShipDateO]![PCBForecast].[Form]![JobNumber] & "' and
[pcbforecast].[ShipETA] = #" &
[Forms]![PCBShipDateO]![PCBForecast].[Form]![ShipETA] & "#"
JobNumber = Number
ShipETA = Date/Time

Basically, as a user tabs of a field on a continuous form, the system
need to test if they have already entered that same date for this
JobNumber previously.

The fields on the form are the same fields from the table which we are
testing against.
Appreciate your help on this.

Thanks

David

Dec 19 '05 #1
2 1374
"David" <go********@googlemail.com> wrote in news:1134992586.697587.136880
@g44g2000cwa.googlegroups.com:
Hi,

I have the following SQL string, but cannot get it working:

strSQL = "SELECT * FROM [pcbforecast] where [pcbforecast].[JobNumber] =
'" & [Forms]![PCBShipDateO]![PCBForecast].[Form]![JobNumber] & "' and
[pcbforecast].[ShipETA] = #" &
[Forms]![PCBShipDateO]![PCBForecast].[Form]![ShipETA] & "#"


Probably you should not put single quotes around a number.

The date thing may or may not be a problem; you may have to format it to be
SURE you have something JET SQL will understand.

And, how do you deal with nulls?

--
Lyle Fairfield
Dec 19 '05 #2
"David" <go********@googlemail.com> wrote in
news:11**********************@g44g2000cwa.googlegr oups.com:
I have the following SQL string, but cannot get it working:

strSQL = "SELECT * FROM [pcbforecast] where
[pcbforecast].[JobNumber] = '" &
[Forms]![PCBShipDateO]![PCBForecast].[Form]![JobNumber] & "' and
[pcbforecast].[ShipETA] = #" &
[Forms]![PCBShipDateO]![PCBForecast].[Form]![ShipETA] & "#"
JobNumber = Number
ShipETA = Date/Time


If JobNumber is *not* text, then you need to get rid of the single
quotes:

"where [pcbforecast].[JobNumber] = "
& [Forms]![PCBShipDateO]![PCBForecast].[Form]![JobNumber]

I can remember back when the issue of when to use quotes and when
not to use them was a complete mystery. Now the distinction is so
clear to me that I can't remember *how* it could ever have been a
mystery.

Someday, you'll be there, too.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 19 '05 #3

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

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
4
by: DBNovice | last post by:
I have a database that keeps records on the issue and failure of an item. Currently, the database is poorly desisned; therefore I'm performing queries to break the data into normalized tables and...
3
by: Brian Oster | last post by:
After applying security patch MS03-031 (Sql server ver 8.00.818) a query that used to execute in under 2 seconds, now takes over 8 Minutes to complete. Any ideas on what the heck might be going...
3
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and...
3
by: Megan | last post by:
hi everybody- it seems like my update query should work. the sql view seems logical. but that might be up to discussion...lol...i'm a newbie! UPDATE , Issue SET .IssueID = . WHERE ((.=.));
5
by: elitecodex | last post by:
Hey everyone. I have this query select * from `TableName` where `SomeIDField` 0 I can open a mysql command prompt and execute this command with no issues. However, Im trying to issue the...
1
by: jpatchak | last post by:
Hi Guys, Sorry if this is a really stupid question. I am trying to upsize my Access database to SQL server. When I used the Access upsizing wizard, some of my queries didn't get upsized so I am...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
7
by: Kelii | last post by:
Well, I've been searching around the groups for an answer to this one, and none of the suggestions seems to be working for me. I'm almost positive that this is a simple fix, but for the life of me...
18
by: JGrizz | last post by:
Greetings, I first off want to state that I am new to the forum, so if this question ends up in the wrong area, I apologize. This pertains to Access 2003/VBA/SQL issues... I have been doing some...
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,...
1
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
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
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
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...

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.