473,406 Members | 2,336 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,406 software developers and data experts.

sql syntax comparing fields

hey im new to this site but found it has helped me in the past with other similar problems. i want to be able to compare 2 fields in my sql my code is as follows:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command1_Click()
  3. Exit Sub
  4. Adodc1.RecordSource = "SELECT Stock.[Product Code], Stock.Description, Stock.[Quantity in Stock], Stock.[Re Order Level] FROM Stock; 
  5. WHERE Stock.[Quantity in Stock]) < Stock.[Re Order Level];"
  6. Adodc1.Recordset.Requery
  7. Adodc1.Refresh
  8. DataGrid1.Refresh
  9. End Sub
  10.  
The bold part is where i appear to be having problems. am i missing quotations or brackets or something?
thnx in advance
Jun 19 '07 #1
4 1265
hey im new to this site but found it has helped me in the past with other similar problems. i want to be able to compare 2 fields in my sql my code is as follows:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command1_Click()
  3. Exit Sub
  4. Adodc1.RecordSource = "SELECT Stock.[Product Code], Stock.Description, Stock.[Quantity in Stock], Stock.[Re Order Level] FROM Stock; 
  5. WHERE Stock.[Quantity in Stock]) < Stock.[Re Order Level];"
  6. Adodc1.Recordset.Requery
  7. Adodc1.Refresh
  8. DataGrid1.Refresh
  9. End Sub
  10.  
The bold part is where i appear to be having problems. am i missing quotations or brackets or something?
thnx in advance
Lose the semicolon ( ; ) at the end of your FROM Stock; but leave it at the end of your sentence.

like this:
Expand|Select|Wrap|Line Numbers
  1. Adodc1.RecordSource = "SELECT Stock.[Product Code], Stock.Description, Stock.[Quantity in Stock], Stock.[Re Order Level] FROM Stock WHERE Stock.[Quantity in Stock]) < Stock.[Re Order Level];"
  2.  
Jasper
Jun 19 '07 #2
cheers, but it still aint doin nothing! datagrid doesnt show the output from the query. :(
Jun 19 '07 #3
cheers, but it still aint doin nothing! datagrid doesnt show the output from the query. :(
Ok, try using Access Query Analyzer to troubleshoot the query I'd say:

http://www.sliver.com/dotnet/AccessQueryAnalyzer/

Good luck,

Jasper
Jun 19 '07 #4
guys im stil struggling on this one i feel its somethin to do with quotation marks!! took me ages to find out how to use them in a text field! any suggestions?
Jun 19 '07 #5

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

Similar topics

4
by: osmethod | last post by:
Hello, I have read many articles about comparing tables, like - loops, delete queries, appending to temp table with index etc Problem: 2 tables T1 & T2. Data is suppposed to be the same in...
1
by: DaveA | last post by:
Our incident numbering system is based on the following YEAR 05 MONTH 06 NMBR 1234 looks like 05-06-1234 the counter number is manually reset each month and I would like to make it...
23
by: Marcin Grzębski | last post by:
I red MSDN article of C# 2.0 this week... and i found very strange syntax for properties e.g.: public int MyIntValue { get { // ... } protected set { // ... }
0
by: richardkreidl | last post by:
I have the following hash script that I use to compare two text files. 'Class Public Class FileComparison Public Class FileComparisonException Public Enum ExceptionType U 'Unknown A 'Add...
2
by: The guy upstairs | last post by:
Am looking for suggestions on comparing two email fields. Have looked in the usual cut and past sites, but none seem to fit. the name of the two fields are email and confirmEmail. Any...
21
by: Kristaps | last post by:
Hi everyone! I have some questions, maybe someone can help me... I write script for table comparing, but it works wery slovly. There is the script, can anyone give some tip how can I make this...
4
by: gillianbrooks91 | last post by:
Forgive me for asking this question, I've trawled through nearly every available post on this subject that I can find for a few weeks now but nothing quite points me in the right direction. I'm...
13
by: ishakarthika | last post by:
how can i compare the a private variable of a class and a value in the column of a text file. there is a syntax error in my code while comparing. senario is i am getting bus details like busno,...
8
by: banderson | last post by:
Hello, I have a combo box in which I want to display multiple fields by concatenating the fields together. If one of those concatenated fields is Null, then the combo box does not show anything. To...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.