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

Problem using the MID Function

I am sure this is something basic that I am missing . . .

I have a MS Access 2003 (SP1) table, DSPLOG2, with one column, columna. columna is derived from a message file on an iSeries machine, and contains a variety of data that I would like to extract into separate columns for reporting purposes.

After doing some research I felt that the "MID" function would be the best way to acheive the desired result, but I have been having problems acheiving success while creating the first query.

I am trying to extract 10 characters starting at character 24 from columna, and put them in a new column, Expr1. (These are not the actual field names.)

This is what I have so far:

Expand|Select|Wrap|Line Numbers
  1.  SELECT MID (columna, 24, 10) AS Expr1
  2. FROM DSPLOG2; 
I keep receiving compile errors: Compile error. in query expression "MID (DSPLOG, 24, 10)'.

Any ideas as to what I am missing? I have spent several hours scouring books, the internet, etc for guidance and I can not find the error in my ways.

Thank you!
Sep 6 '07 #1
7 8910
Rabbit
12,516 Expert Mod 8TB
There shouldn't be a space between Mid and ().
Sep 6 '07 #2
Thanks for the quick reply Rabbit. The information you and the others on this board have dispensed has been extremely helpful to me while I have been working with MS Access.

Unfortunately I still receive the same error if I remove the space between MID and "(".

I have played around with the spaces, and have not found a combo that seems to fix the error, as of yet.
Sep 6 '07 #3
puppydogbuddy
1,923 Expert 1GB
Thanks for the quick reply Rabbit. The information you and the others on this board have dispensed has been extremely helpful to me while I have been working with MS Access.

Unfortunately I still receive the same error if I remove the space between MID and "(".

I have played around with the spaces, and have not found a combo that seems to fix the error, as of yet.

Try this:

SELECT MID([columna], 24, 10) AS Expr1
FROM DSPLOG2;

Or This if the above doesn't work:

SELECT columna, MID([columna], 24, 10) AS Expr1
FROM DSPLOG2;
Sep 6 '07 #4
I tried the first one previously to no avail. Just tried the second option with the same compile error. Could it be something to do with the setup of the table? Here are the parameters for it:
Type - text
Field size - 150
Required - No
Allow Zero Length - Yes
Indexed - No
Unicode Compression - No
IME Mode - No Control
IME Sentence Mode - None

I only listed the parameters that were populated.

Thanks again . . .
Sep 6 '07 #5
puppydogbuddy
1,923 Expert 1GB
I tried the first one previously to no avail. Just tried the second option with the same compile error. Could it be something to do with the setup of the table? Here are the parameters for it:
Type - text
Field size - 150
Required - No
Allow Zero Length - Yes
Indexed - No
Unicode Compression - No
IME Mode - No Control
IME Sentence Mode - None

I only listed the parameters that were populated.

Thanks again . . .
Of the table setup, I don't think any of the settings are problematic as far as the Mid function. If any of the settings were a problem, I would think it could be allow zero length string.

I am beginning to wonder if maybe you are missing a vb library reference to DAO or ? check your vb library references and see if any are shown as missing.

Another test you could do is hit CTRL + G to bring up the immediate window, type the line below and see if it works:
?Mid("ThisIsATest", 8, 4)

I am going to research problems with the mid function later and get back to you, if I find anything.
Sep 6 '07 #6
You are a genius.

When I went to the submit immediate window it also pulled up all of this garbage I was toying with a long time ago. The statement you gave me did not work at first, and it gave me a compile error. I removed the junk module and your statement worked. I swiched back to my query and low and behold it works.

Thanks a million!!! I was a couple of minutes away from rocking back and forth in the corner mumbling to myself. This has been hours of making minute changes to the code, and that was before I posted. I would have never looked there. Thanks for everyone's input and help!!!!!
Sep 6 '07 #7
puppydogbuddy
1,923 Expert 1GB
You are a genius.

When I went to the submit immediate window it also pulled up all of this garbage I was toying with a long time ago. The statement you gave me did not work at first, and it gave me a compile error. I removed the junk module and your statement worked. I swiched back to my query and low and behold it works.

Thanks a million!!! I was a couple of minutes away from rocking back and forth in the corner mumbling to myself. This has been hours of making minute changes to the code, and that was before I posted. I would have never looked there. Thanks for everyone's input and help!!!!!
You are most welcome! Glad you got your problem resolved, and that we could help you..
Sep 7 '07 #8

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

Similar topics

4
by: Leslaw Bieniasz | last post by:
Cracow, 20.09.2004 Hello, I need to implement a library containing a hierarchy of classes together with some binary operations on objects. To fix attention, let me assume that it is a...
36
by: AussieRules | last post by:
Hi, I want to use the user color scheme to set the color of my forms. I now I have to use the. System.Drawing.SystemColors, but which color is the color of a form background as used in other...
12
by: Joel Byrd | last post by:
I'm having a little problem with using type-ahead functionality for an auto-suggest box. Sometimes, when I start to type something and the type-ahead shows up, the AJAX will send a request query...
0
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
5
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
6
by: per9000 | last post by:
An interesting/annoying problem. I created a small example to provoke an exception I keep getting. Basically I have a C-struct (Container) with a function-pointer in it. I perform repeated calls...
3
by: StephQ | last post by:
I'm writing some algorithms that works on generic functions using boost::bind. My problem is that class templates can never be deduced. In the simplest cases I just write the class like: ...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
5
by: jbenner | last post by:
I have opened a PMR for this with IBM, and am not asking for advice from the DB2 DBA community. I am posting this as an FYI that DB2 Health Monitor, even at the latest version of DB2, still can cause...
6
by: pauldepstein | last post by:
Let double NR( double x, double(*)(const double&) f ) be the signature of a Newton-Raphson function NR. Here, f is a function which returns a double and accepts a const double&. The aim of...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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.