473,569 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with SQL please......... .

Hi,

Please can you help me get this code to run ?

--------------------

Dim dbs2 As DAO.Database, rst2 As DAO.Recordset, str2 As String
Set dbs2 = CurrentDb

strtest2 = "SELECT products.ProdCo de, products.Produc tIdentify FROM
products"
strtest2 = strtest2 & " WHERE Products.ProdCo de=" & Me.NewCopyProdC ode
& " AND products.Produc tIdentify=" & Me.Combo8.Colum n(1) & ";"
Set rst2 = dbs2.OpenRecord set(strtest2, dbOpenForwardOn ly)

If rst2.EOF Then
MsgBox "This product already exists"
Else
End If

--------------------
Basically, a user enters a code into the text field 'NewCopyProdCod e' ,
then selects from a dropdown 'Combo8' and then the system will test if
a current version alredy exists prior to creating a new entry, from the
afterupdate event of the combo.


Thank you so much if you can help :-)
David

Nov 13 '05 #1
4 1392
"David" <da*********@sc ene-double.co.uk> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hi,

Please can you help me get this code to run ?

--------------------

Dim dbs2 As DAO.Database, rst2 As DAO.Recordset, str2 As String
Set dbs2 = CurrentDb

strtest2 = "SELECT products.ProdCo de, products.Produc tIdentify FROM
products"
strtest2 = strtest2 & " WHERE Products.ProdCo de=" & Me.NewCopyProdC ode
& " AND products.Produc tIdentify=" & Me.Combo8.Colum n(1) & ";"
Set rst2 = dbs2.OpenRecord set(strtest2, dbOpenForwardOn ly)

If rst2.EOF Then
MsgBox "This product already exists"
Else
End If

--------------------
Basically, a user enters a code into the text field 'NewCopyProdCod e' ,
then selects from a dropdown 'Combo8' and then the system will test if
a current version alredy exists prior to creating a new entry, from the
afterupdate event of the combo.


Where is the code run from? Do you try to run it and get errors, if so,
what are they? Are the text box and combo bound to text or number fields?

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #2
Thanks Keith,

This is a simple pop-up form with a text box & dropdown.
It is basically to test for duplicates prior to setting up new products

After the dropdown (After Update), I get an error 3075, syntax error
(missing operator) in query expression..... ..

The text box is unbound - it just takes a name the user wants to use.
The combo selects fields from a table, the required field being of
text type.

Thanks

David

Nov 13 '05 #3
"David" <da*********@sc ene-double.co.uk> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Thanks Keith,

This is a simple pop-up form with a text box & dropdown.
It is basically to test for duplicates prior to setting up new products

After the dropdown (After Update), I get an error 3075, syntax error
(missing operator) in query expression..... ..

The text box is unbound - it just takes a name the user wants to use.
The combo selects fields from a table, the required field being of
text type.

Hi David,

Well for starters, and I'm not sure off the top of my head if this will stop
the error, you need quotation marks for the text box and the combo if they
are dealing with text:

strtest2 = strtest2 & " WHERE Products.ProdCo de = '" & Me.NewCopyProdC ode &
"' AND products.Produc tIdentify = '" & Me.Combo8.Colum n(1) & "';"

Try that and let us know ...

Keith.
Nov 13 '05 #4

Keith wrote:
"David" <da*********@sc ene-double.co.uk> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Thanks Keith,

This is a simple pop-up form with a text box & dropdown.
It is basically to test for duplicates prior to setting up new products

After the dropdown (After Update), I get an error 3075, syntax error
(missing operator) in query expression..... ..

The text box is unbound - it just takes a name the user wants to use.
The combo selects fields from a table, the required field being of
text type.

Hi David,

Well for starters, and I'm not sure off the top of my head if this will stop
the error, you need quotation marks for the text box and the combo if they
are dealing with text:

strtest2 = strtest2 & " WHERE Products.ProdCo de = '" & Me.NewCopyProdC ode &
"' AND products.Produc tIdentify = '" & Me.Combo8.Colum n(1) & "';"

Try that and let us know ...

Keith.


-----------------------------------

Thanks Keith,

I had already fixed it .... bugs in my code, I was selecting the wrong
field from the combo and testing a numeric against a text....DOH .... I
win the prize idiot competition. Thanks for your help anyway :-)
David

Nov 13 '05 #5

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

Similar topics

3
3258
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old scripts working on a new server with the most recent version of PHP. I've pretty much taken care of all the various errors that were popping up. ...
1
1934
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the past 2 weeks now i give up and call for help. Please if anyone can gide me through i will be so grateful!! I have pasted my code below
0
1688
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web browser that Hotmail does not support. If you continue to use your current browser software we cannot guarantee that Hotmail will work correctly for...
12
2099
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem cout << "Please Enter First number: ";
7
3584
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
5
2975
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig <<<<<<<<<<<<<<CODE>>>>>>>>>>>>>>>> <html>
17
2014
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will trace the title and price of the book automatically. The system should check whether the book is in the stock or not. If it is not, please let the...
7
3264
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that I believe if it's solved, the remaining stuff is easy... my full program until now is here: http://www.geocities.com/tom4_h4wk/progmail.zip the...
23
3245
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application to create certain textboxes, labels, and combo boxes? Any ideas would be appreciated. Thanks
2
1535
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
I'm creating a doc project for my c# program. I've done this before but this time sonething is wrong. I build my doc project and is succeeds but when I open the help file, there is no documentation there. I enabled XML documentation file under build properties and have recompiled my program but still I have nothing. What am I doing wrong? --...
0
7697
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, 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...
0
7612
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...
0
7924
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, 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. ...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
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...
0
6283
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.