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

Editing question: locating a charter within a string!

Hi:

Hi:

I have a linked query, which includes a specially constructed Key from a data base, in the
form: 25-1-1, although the fields may be any number of digits. For purposes of discussion,
call this field KEY

I need to select a field from another record and substitute the value of that field for
the first n digits of the KEY above. Call that field Newfield.

I was planning on doing a: "newfield&right(KEY,find(KEY,"-"))" which would, in theory
strip out the first n digits of the KEY field and substitute the new field. I just cant
locate a command in the macro set for Access that returns the number of characters that a
specific value is into the string, which is what I need.

I want the following result:
Newfield = 2343
Key = 25-1-1
Result should be 2343-1-1

Believe me, this isn't the way I would like to deal with it but i am maintaining a system
with massive spaghetti code, and have no time to rewrite it!!

Help appreciated

Best

John Baker
Nov 13 '05 #1
4 1710
John Baker wrote:
Hi:

Hi:

I have a linked query, which includes a specially constructed Key from a data base, in the
form: 25-1-1, although the fields may be any number of digits. For purposes of discussion,
call this field KEY

I need to select a field from another record and substitute the value of that field for
the first n digits of the KEY above. Call that field Newfield.

I was planning on doing a: "newfield&right(KEY,find(KEY,"-"))" which would, in theory
strip out the first n digits of the KEY field and substitute the new field. I just cant
locate a command in the macro set for Access that returns the number of characters that a
specific value is into the string, which is what I need.

I want the following result:
Newfield = 2343
Key = 25-1-1
Result should be 2343-1-1

Believe me, this isn't the way I would like to deal with it but i am maintaining a system
with massive spaghetti code, and have no time to rewrite it!!

Help appreciated

Best

John Baker


Look up Instr in Help.

Nov 13 '05 #2
[newfield] & Right([TheKey],Len([TheKey])-(InStr(1,[TheKey],"-")-1))

- Jim

On Mon, 05 Jul 2004 16:51:10 GMT, John Baker <Ba******@Verizon.net>
wrote:
Hi:

Hi:

I have a linked query, which includes a specially constructed Key from a data base, in the
form: 25-1-1, although the fields may be any number of digits. For purposes of discussion,
call this field KEY

I need to select a field from another record and substitute the value of that field for
the first n digits of the KEY above. Call that field Newfield.

I was planning on doing a: "newfield&right(KEY,find(KEY,"-"))" which would, in theory
strip out the first n digits of the KEY field and substitute the new field. I just cant
locate a command in the macro set for Access that returns the number of characters that a
specific value is into the string, which is what I need.

I want the following result:
Newfield = 2343
Key = 25-1-1
Result should be 2343-1-1

Believe me, this isn't the way I would like to deal with it but i am maintaining a system
with massive spaghetti code, and have no time to rewrite it!!

Help appreciated

Best

John Baker


Nov 13 '05 #3
Bruce:

Thanks.

I had looked it up before I wrote the note, and found no joy in the help file at all! The
fact that the examples were based on oriental characters didn't help to clarify the
situation at all. All I need is the command and the parameters. ONce I have that I should
(fingers crossed) be ok.

Best

John

Bruce Dodds <br********@comcast.net> wrote:
John Baker wrote:
Hi:

Hi:

I have a linked query, which includes a specially constructed Key from a data base, in the
form: 25-1-1, although the fields may be any number of digits. For purposes of discussion,
call this field KEY

I need to select a field from another record and substitute the value of that field for
the first n digits of the KEY above. Call that field Newfield.

I was planning on doing a: "newfield&right(KEY,find(KEY,"-"))" which would, in theory
strip out the first n digits of the KEY field and substitute the new field. I just cant
locate a command in the macro set for Access that returns the number of characters that a
specific value is into the string, which is what I need.

I want the following result:
Newfield = 2343
Key = 25-1-1
Result should be 2343-1-1

Believe me, this isn't the way I would like to deal with it but i am maintaining a system
with massive spaghetti code, and have no time to rewrite it!!

Help appreciated

Best

John Baker


Look up Instr in Help.


Nov 13 '05 #4
Jim:

Thanks a lot.

John

Ji****@NOTdatacentricsolutions.com (Jim Allensworth) wrote:
[newfield] & Right([TheKey],Len([TheKey])-(InStr(1,[TheKey],"-")-1))

- Jim

On Mon, 05 Jul 2004 16:51:10 GMT, John Baker <Ba******@Verizon.net>
wrote:
Hi:

Hi:

I have a linked query, which includes a specially constructed Key from a data base, in the
form: 25-1-1, although the fields may be any number of digits. For purposes of discussion,
call this field KEY

I need to select a field from another record and substitute the value of that field for
the first n digits of the KEY above. Call that field Newfield.

I was planning on doing a: "newfield&right(KEY,find(KEY,"-"))" which would, in theory
strip out the first n digits of the KEY field and substitute the new field. I just cant
locate a command in the macro set for Access that returns the number of characters that a
specific value is into the string, which is what I need.

I want the following result:
Newfield = 2343
Key = 25-1-1
Result should be 2343-1-1

Believe me, this isn't the way I would like to deal with it but i am maintaining a system
with massive spaghetti code, and have no time to rewrite it!!

Help appreciated

Best

John Baker


Nov 13 '05 #5

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

Similar topics

6
by: Hunter Hou | last post by:
Hello, I have this very simple program, but it can't be compiled. What's wrong here? thanks, hunter #include <iostream>
20
by: Rich Grise | last post by:
I've been lurking for awhile, and I notice that there are some real tight-assed prigs around here. Bitch, bitch, bitch. So what if it's not "Standard C?" If it looks like C, smells like C,...
46
by: sbayeta | last post by:
Hi, I'd like to know who is responsible of memory recycling and defragmentation in a C/C++ program, assuming all the memory allocation/deallocation is done using malloc/free or new/delete. ...
0
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have...
6
by: | last post by:
Hi all, can anyone recommend a good html editing control for asp.net? Kind of like the ones web email sites have on their compose page e.g. hotmail, yahoo etc. TIA!
3
by: Gary Brown | last post by:
Hi, Is there a resource that lists where a control's variables are put? VC puts data such as a ListView's Items in fields that bear no resemblance to the programmer's view. After documenting...
1
by: pmclinn | last post by:
I have created a DB from within my Visual studio 2005 development studio. My connection string works well on my local machine but when I copy this to my remote server I get this error: When...
0
by: Rob Meade | last post by:
Dear all, I've followed two examples online now and experienced the same problem/error with both... I create a new webform, add a webpartmanager, add a table with three cells, plonk a...
9
by: news.microsoft.com | last post by:
I am looping through an iteration and I would like to test the next item but if its not the one that I want how do I put it back so that when my foreach continues it is in the next iteration? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.