473,472 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VBA Syntax Error

5 New Member
I'm new to programming and very unfamiliar with VBA - would welcome any advice on the following... When run in Access, the following code is highlighted as a syntax error. Grateful for any feedback! Many thanks.


strLocMessage = strLocMessage & vbCrLf & "Break Down of Order" & vbCrLf & _

" £2 - £ " & Me![£2Coin] & vbCrLf & _
" £1 - £ " & Me![£1Coin] & vbCrLf & _
" 50p - £ " & Me![50pcoin] & vbCrLf & _
" 20p - £ " & Me![20pcoin] & vbCrLf & _
" 10p - £ " & Me![10pcoin] & vbCrLf & _
" 5p - £ " & Me![5pcoin] & vbCrLf & _
" 2p - £ " & Me![2pcoin] & vbCrLf & _
" 1p - £ " & Me![1pcoin] & vbCrLf & _

"Total Amount " & Me![TotalValue] & vbCrLf & _
"Delivery Date " & Format(Me![DateReady], "dddd dd mmmm yyyy") & vbCrLf & vbCrLf & _
"Please arrange for this order to delivered to the store on the above date. " & vbCrLf
Sep 19 '07 #1
4 1253
FishVal
2,653 Recognized Expert Specialist
:-)

Try to split the code line to localize where does error actually raise.
Sep 19 '07 #2
MMcCarthy
14,534 Recognized Expert Moderator MVP
The obvious problem would be if you are leaving blank lines as per your post then this would cause an error. There should be no blank lines.

Expand|Select|Wrap|Line Numbers
  1. strLocMessage = strLocMessage & vbCrLf & "Break Down of Order" & vbCrLf & _
  2. " £2 - £ " & Me![£2Coin] & vbCrLf & _
  3. " £1 - £ " & Me![£1Coin] & vbCrLf & _
  4. " 50p - £ " & Me![50pcoin] & vbCrLf & _
  5. " 20p - £ " & Me![20pcoin] & vbCrLf & _
  6. " 10p - £ " & Me![10pcoin] & vbCrLf & _
  7. " 5p - £ " & Me![5pcoin] & vbCrLf & _
  8. " 2p - £ " & Me![2pcoin] & vbCrLf & _
  9. " 1p - £ " & Me![1pcoin] & vbCrLf & _
  10. "Total Amount " & Me![TotalValue] & vbCrLf & _
  11. "Delivery Date " & Format(Me![DateReady], "dddd dd mmmm yyyy") & vbCrLf & vbCrLf & _
  12. "Please arrange for this order to delivered to the store on the above date. " & vbCrLf
  13.  
Sep 19 '07 #3
LShuttle
5 New Member
Many thanks for your your advice - tried it and it works like a charm!

The obvious problem would be if you are leaving blank lines as per your post then this would cause an error. There should be no blank lines.

Expand|Select|Wrap|Line Numbers
  1. strLocMessage = strLocMessage & vbCrLf & "Break Down of Order" & vbCrLf & _
  2. " £2 - £ " & Me![£2Coin] & vbCrLf & _
  3. " £1 - £ " & Me![£1Coin] & vbCrLf & _
  4. " 50p - £ " & Me![50pcoin] & vbCrLf & _
  5. " 20p - £ " & Me![20pcoin] & vbCrLf & _
  6. " 10p - £ " & Me![10pcoin] & vbCrLf & _
  7. " 5p - £ " & Me![5pcoin] & vbCrLf & _
  8. " 2p - £ " & Me![2pcoin] & vbCrLf & _
  9. " 1p - £ " & Me![1pcoin] & vbCrLf & _
  10. "Total Amount " & Me![TotalValue] & vbCrLf & _
  11. "Delivery Date " & Format(Me![DateReady], "dddd dd mmmm yyyy") & vbCrLf & vbCrLf & _
  12. "Please arrange for this order to delivered to the store on the above date. " & vbCrLf
  13.  
Sep 19 '07 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
Many thanks for your your advice - tried it and it works like a charm!
I'm happy that solved your problem.
Sep 19 '07 #5

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

Similar topics

1
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. ...
1
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...
5
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...
2
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...
3
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...
1
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 ...
7
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...
7
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",...
6
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
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...
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
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
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,...
1
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: 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...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.