473,805 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax Error

Hello Access Monsters,

I have a table with three columns. "CostCenter ", "ProjectNumber" , "GLCode"
On my form I have three texboxes, "txtCostCenter" , "txtProjectNumb er" and
"txtGLCode" .
the AfterUpdate event of the txtCostCenter runs the following code.

Me.txtProjectNu mber = DLookup("Projec tNumber", "tblList", "CostCenter =" & Me.
txtCostCenter)
Me.txtGLCode = DLookup("GLCode ", "tblList", "CostCenter =" & Me.txtCostCente r)
This works perfectly, however, sometimes the user may not have the CostCenter
so he will enter the ProjectNumber. Thus I have the AfterUpdate event of the
"txtProjectNumb er" set to the following.

Me.txtGLCode = DLookup("GLCode ", "tblList", "ProjectNum ber =" & Me.
txtProjectNumbe r)

When entering the ProjectNumber I get the syntax error '3075' "syntax error
in number in query expression 'ProjectNumber = 4190740.1570003 .00'

All my project numbers come in that format. Is it the format of the data
causing this?

--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200709/1

Sep 5 '07 #1
3 1808
injanib via AccessMonster.c om wrote:
Hello Access Monsters,

I have a table with three columns. "CostCenter ", "ProjectNumber" , "GLCode"
On my form I have three texboxes, "txtCostCenter" , "txtProjectNumb er" and
"txtGLCode" .
the AfterUpdate event of the txtCostCenter runs the following code.

Me.txtProjectNu mber = DLookup("Projec tNumber", "tblList", "CostCenter =" & Me.
txtCostCenter)
Me.txtGLCode = DLookup("GLCode ", "tblList", "CostCenter =" & Me.txtCostCente r)
This works perfectly, however, sometimes the user may not have the CostCenter
so he will enter the ProjectNumber. Thus I have the AfterUpdate event of the
"txtProjectNumb er" set to the following.

Me.txtGLCode = DLookup("GLCode ", "tblList", "ProjectNum ber =" & Me.
txtProjectNumbe r)

When entering the ProjectNumber I get the syntax error '3075' "syntax error
in number in query expression 'ProjectNumber = 4190740.1570003 .00'

All my project numbers come in that format. Is it the format of the data
causing this?
Numbers don't get surrounded by quotes. Text fields do. Dates are
surrounded by #s. So maybe
Me.txtGLCode = DLookup("GLCode ", "tblList", _
"ProjectNum ber =""" & Me.txtProjectNu mber & """)
would work.
Sep 5 '07 #2
The only field that is a number field is the txtCostCenter field with which I
don't have any problem. The txtProjectNumbe r and txtGLCode fields are text
fields since there are multiple dots and hyfens appearing in each one.

I tried the method you suggested and I still get a syntax error. The error is:

"Run-time error '3075' "
Syntax error in string query expression 'ProjectNumber ="4199700.00 '
Salad wrote:
>Hello Access Monsters,
[quoted text clipped - 19 lines]
>All my project numbers come in that format. Is it the format of the data
causing this?

Numbers don't get surrounded by quotes. Text fields do. Dates are
surrounded by #s. So maybe
Me.txtGLCode = DLookup("GLCode ", "tblList", _
"ProjectNum ber =""" & Me.txtProjectNu mber & """)
would work.
--
Message posted via http://www.accessmonster.com

Sep 6 '07 #3
Never Mind. I figured it out. You were right. It had to do with quotation
marks. Thanks allot.

injanib wrote:
>The only field that is a number field is the txtCostCenter field with which I
don't have any problem. The txtProjectNumbe r and txtGLCode fields are text
fields since there are multiple dots and hyfens appearing in each one.

I tried the method you suggested and I still get a syntax error. The error is:

"Run-time error '3075' "
Syntax error in string query expression 'ProjectNumber ="4199700.00 '
>>Hello Access Monsters,
[quoted text clipped - 7 lines]
>> "ProjectNum ber =""" & Me.txtProjectNu mber & """)
would work.
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200709/1

Sep 6 '07 #4

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

Similar topics

1
3356
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. The purpose of the code is simply to delete a record and then redirect back to the page where the delete was started. The code looks like this: elseif ($_GET == "delete") { $query = "delete from product_subcategory2 where product_sku=$_GET and...
1
3242
by: Donald Canton | last post by:
Hi, I'm using Bjarne's book to learn C++ and am stuck on the Calc program in Section 6. Everything works fine except when I try to use istringstream to parse a token from the command line. I thought I followed his instructions on page 118 correctly, but I can't get it to compile without syntax errors in the get_token() function. The whole program follows with the four syntax errors flagged with the text "// SYNTAX ERROR". Thanks in...
5
4523
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by including the -q64 option in xlC compiler. And we are able to link all these libraries to one of the main applications and generate an executable. SKLoader. But, when we try to run this main executable, we are getting the following errors:
2
2269
by: david | last post by:
Anyone could give me a hand about this syntax error? Thank you. David Source Code: Dim conn As New SqlConnection(strConn) Dim daAngio As New SqlDataAdapter(strSelectStatement, conn) 'Create a dataset Dim dsAngio As New DataSet 'fill in the dataset by adapter daAngio.Fill(dsAngio, "AngioInfo") Dim ok As Boolean = False
3
16255
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very strange error. In your experience, where I should looking to find the real error? Surely the sintax of glut is correct... gcc.exe -c glut_bitmap.c -o glut_bitmap.o -I"C:/Dev-Cpp/include" -I"../../include" -D__GNUWIN32__ -W -DWIN32 -DNDEBUG...
1
2235
by: Hari Sekhon | last post by:
I've written an except hook into a script as shown below which works well for the most part and catches exceptions. import sys def myexcepthook(type,value,tb): do something sys.excepthook=myexcepthook rest of script.... (now protected by catchall exception hook)
7
1841
by: Josh | last post by:
I have a lot of except Exception, e statements in my code, which poses some problems. One of the biggest is whenever I refactor even the triviallest thing in my code. I would like python to abort, almost as if it were a compile-time error, whenever it cannot find a function, or if I introduced a syntax error. But, instead, it merrily proceeds on its way. Is there some idiom that you use in situations like these? thanks,
7
2894
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM", "OE_HDR"."SLS_MAN_NO", "OE_HDR"."SLS_MAN_INITIALS", "OE_HDR"."ORD_DAT", "OE_HDR"."SHIP_DAT" FROM "OE_HDR" WHERE ("OE_HDR"."ORD_NO"='174310') I also have DropDownList1 working properly. For the WHERE portion of
6
38084
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
5
4026
Banfa
by: Banfa | last post by:
So I have a little problem, I have a template class and that class contains a template function; now what I want to do is declare that function in the class (or indeed the entire class) as a friend of all specialisations of the class. I did that (or thought I did) but the code I produced compiles with gcc 3.4.2 but not with Microsoft Visual Studio 2008 (Express Edition). So I have reduced my code to a minimum compilable example that exhibits...
0
9596
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10609
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10360
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10105
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 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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9185
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3007
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.