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

vba End If without block If - error when Compiling

my Code:
Expand|Select|Wrap|Line Numbers
  1. If (RaceHorsesIX("Track") = "APX" Or _
  2.     RaceHorsesIX("Track") = "ALB" Or _
  3.     RaceHorsesIX("Track") = "AQU" Or _
  4.     RaceHorsesIX("Track") = "BEL" Or _
  5.     RaceHorsesIX("Track") = "BEU" Or _
  6.     RaceHorsesIX("Track") = "CBY" Or _
  7.     RaceHorsesIX("Track") = "CDX" Or _
  8.     RaceHorsesIX("Track") = "CTX" Or _
  9.     RaceHorsesIX("Track") = "DED" Or _
  10.     RaceHorsesIX("Track") = "EMD" Or _
  11.     RaceHorsesIX("Track") = "EVD" Or _
  12.     RaceHorsesIX("Track") = "FLX") Then _
  13.         GoTo TrackOK
  14. End If
HELP!!!
Jul 25 '14 #1

✓ answered by twinnyfo

one of two things:

Either get rid of the line continuation after "Then" or just delete "END IF"

2 1576
twinnyfo
3,653 Expert Mod 2GB
one of two things:

Either get rid of the line continuation after "Then" or just delete "END IF"
Jul 25 '14 #2
zmbd
5,501 Expert Mod 4TB
YUCK, what a hard code to maintain.
IMHO:
If you have to hard code this, then the
Select...Case statement would be better:
Expand|Select|Wrap|Line Numbers
  1. Select UCASE(RaceHorsesIX("Track"))
  2.    Case "APX","ALB", "AQU", "BEL" ...
  3.       your code here
  4.    case else
  5.       your code here
  6. end select
  7.  
Easier to read and IMHO maintain.
-
Better yet, place these tracks in a table.
Then open a recordset on the table with the WHERE clause set to pull the one record. Then check to see if there are any records in the set.
Then as you add "Tracks" you do not need to re-code the application at all. (^_^)

(also as of late... the GOTO statment isn't considered best practice anymore prefered is to call another module or function; however, I'm old school so it doesn't bother me so long as the code is readable and maintainable. (^_^) )
Jul 29 '14 #3

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

Similar topics

0
by: Francisco J. Reyes | last post by:
I get an Internal complier error when compiling C# windows project that uses a custom Class add as reference to the project. The problem appears to be related to the ENUM type used in the class...
22
by: TuPLaD | last post by:
Hello, I just made a little C++ console application: #include "iostream" using namespace std; int main () { cout << "Hello Mars !"; return 0;
2
by: Richard B | last post by:
I added a .NET dll as a reference to my new .NET dll. When I went to build, I received error "Unable to emit assembly: Referenced assembly 'CrystalReport' does not have a strong name". ...
6
by: mihailsmilev | last post by:
Hello, let me first describe the situation: I am developing an application using Qt Designer 3.3.5 on OpenSuSE Linux for my mp3 player. So I need to get the id3 tags from the mp3 files, and I've...
2
by: etienne | last post by:
Hello, I'm trying to compile this C++ code with gcc 3.4.5 under Solaris/SPARC (from a complete application, the file is : FullLinkedList.hh) but the make fails (no problem when compiling under...
6
by: tony | last post by:
Hello! I have several projects where each one build a library.(class library or window control library). Now I get some strange compile error when building the *.exe file and doesn't...
0
by: jmawebco | last post by:
I have a project I'm working on in VS2005 using vb.net with a MSSql 2005 backend. Everytime I try to run the application I get the same error message; ********* ERROR ********* Compilation...
1
by: =?Utf-8?B?UGllcnJl?= | last post by:
Hello, I have an simle application that uses a referenced library of my own. It's been a year now that I have no problems until a few days. Here is the details of my problem: The library...
1
by: AravindS | last post by:
Hi In one of my projects I have to consume an VC8 compiled library from within a VC6 application. When i compile my application in VC6 i get a linker error error LNK2001: unresolved external...
1
kirubagari
by: kirubagari | last post by:
/* Open file and write out header info */ //sprintf(fullPath, "%s/%s", fPath ,fName); fPtr = fopen("./error_file.log", "a+"); if( fPtr == NULL ) { This is my code and im getting error ...
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?
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
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
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,...
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...

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.