Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-28-2009, 01:42 PM   #1
Dranoweb
Newly Registered User
 
Join Date: Sep 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Dranoweb is on a distinguished road
Split string, execute function, delete split.

Hi all,

Working on a morse code translation function for a database in access 07

I'm having a little trouble working out how to acheive the next step.

I need to be able to take the first 3 characters (from a string of morse) from a text box, send them to a variable for use in a code, and then delete them from the string.

the entire process would need to cycle until the end of the string.

I have had experiments with various commands but just can't seem to grasp how to get thos characters to somewhere useful.

ultimately I would like to be able to compare to a table, but I'll hard code it if I have to for the short term.

I'm not new to vb6/.net/vba but have had little experience in the more complex side. (eg: splitting variables/strings)

Thanks in advance for your time and assistance.

Dranoweb is offline   Reply With Quote
Old 09-28-2009, 02:55 PM   #2
BrettM
just a pert, "ex" to come
 
BrettM's Avatar
 
Join Date: Apr 2008
Location: Sydney - Australia
Posts: 134
Thanks: 0
Thanked 0 Times in 0 Posts
BrettM is on a distinguished road
Re: Split string, execute function, delete split.

How about something like...

Code:
If Len(TextBox) Mod 3 <> 0 then Exit 'Not in groups of 3
 
StrBal= TextBox
Do While Len(StrBal) > 0
   LeftBit = Left(StrBal, 3)
   'Do something with it
   StrBal= Right(StrBal, len(StrBal) - 3)
Loop
__________________
Brett Merriman

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Welcome to Sherwood M'lady.
BrettM is offline   Reply With Quote
Old 09-28-2009, 03:01 PM   #3
Dranoweb
Newly Registered User
 
Join Date: Sep 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Dranoweb is on a distinguished road
Re: Split string, execute function, delete split.

Thats gracefully simple, and I will try that.

Loops are not my strong point, but no time like the present to lean.

Will post again with the results. TY muchly.

Dranoweb is offline   Reply With Quote
Old 09-28-2009, 03:06 PM   #4
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,829 Times in 1,579 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Re: Split string, execute function, delete split.

Quote:
Originally Posted by Dranoweb View Post
Thats gracefully simple, and I will try that.

Loops are not my strong point, but no time like the present to lean.

Will post again with the results. TY muchly.
If that doesn't work - is it one long string or are there spaces between the sets?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Old 09-28-2009, 03:11 PM   #5
BrettM
just a pert, "ex" to come
 
BrettM's Avatar
 
Join Date: Apr 2008
Location: Sydney - Australia
Posts: 134
Thanks: 0
Thanked 0 Times in 0 Posts
BrettM is on a distinguished road
Re: Split string, execute function, delete split.

You could also do it with a For Next if you prefer...

Code:
If Len(TextBox) Mod 3 <> 0 then Exit 'Not in groups of 3
 
StrBal= TextBox
For I = 1 to Len(TextBox) step 3
   LeftBit = Mid(TextBox, i ,3)
   'Do something with it
Next I
I think I have the Mid syntax right.
__________________
Brett Merriman

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Welcome to Sherwood M'lady.
BrettM is offline   Reply With Quote
Old 09-28-2009, 03:15 PM   #6
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,829 Times in 1,579 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Re: Split string, execute function, delete split.

And if there is a space or something else between each set of 3 (which I'm assuming there is NOT), the Split function would work great. Otherwise you do have to step through capturing 3 at a time and moving on as Brett said.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Old 09-28-2009, 03:16 PM   #7
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,814
Thanks: 56
Thanked 1,028 Times in 994 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: Split string, execute function, delete split.

how does the letter timing behave in a string of morse. is there an endchar character after each letter grouping, or something else.

so do you want to get three morse letters, and then change them into 3 real text characters - or something different.

ie how would you distinguish


-. . ie dash dot, then dot

from say

- .. dash, then dot dot

__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Old 09-29-2009, 12:05 AM   #8
Dranoweb
Newly Registered User
 
Join Date: Sep 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Dranoweb is on a distinguished road
Re: Split string, execute function, delete split.

Ok, a few questions to answer here.

I have a large collection of text files generated by a radio translation program.

The choice of 3 characters is an arbitrary choice as international morse varies in length.

I do however need to analyze the data I have. There are NO spaces between each morse letter, hence the need to analyze the string.

my hope is to flag points where certain callsigns are transmitted, and this should help me to separate individual conversations.

I have some other tasks that could be solved with the same system also.

I must thank everyone for such a rapid response. I have only a few hours each night to work on this project. i should have some results tonight all the same.
Dranoweb is offline   Reply With Quote
Old 09-29-2009, 12:58 AM   #9
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,814
Thanks: 56
Thanked 1,028 Times in 994 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: Split string, execute function, delete split.

if there are no spaces beteen letters, how can you split it at all

eg, how do you know that any given dot is an E character, and not part of a different character. i dont know the morse alphabet completely, but presumably a string of dots and dashes could be split into any number of valid letter sequences, now a human operator may get a feel for this somehow, but a computer will struggle - it will be something akin to predictive text on mobile phones, but far worse i would think

when morse is sent manually how does the operator distinguish between characters?
does the operator put a tiny delay between characters - or is it really the skill of the operator that lets him pick the letters
__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Old 09-29-2009, 01:12 AM   #10
Atomic Shrimp
Humanoid lifeform
 
Join Date: Jun 2000
Location: Portsmouth, England
Posts: 1,954
Thanks: 0
Thanked 8 Times in 7 Posts
Atomic Shrimp has a spectacular aura about Atomic Shrimp has a spectacular aura about
Re: Split string, execute function, delete split.

If there are no spaces between the groups of symbols, how can you hope to make any sense of it?
A = .-
E= .
I= ..
L= .-..
N= -.
T= -

So without spaces, the morse sequence .-.. could mean L, or it could mean AI, ATT, ETI, ETEE, ENE...

After assuming the length of the first chunk of morse, the start of the remaining string might not even be the start of a character group.

Without spaces, about the only way to work out the meaning is either to calculate all possible meanings for a sequence, then compare it to a lexicon, or to start by searching for sequences representing known common words, but either of those could fail quite spectacularly in some circumstances.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- it's not radioactive, and contains only a few crustaceans.

Last edited by Atomic Shrimp; 09-29-2009 at 01:23 AM.
Atomic Shrimp is offline   Reply With Quote
Old 09-29-2009, 01:48 AM   #11
Dranoweb
Newly Registered User
 
Join Date: Sep 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Dranoweb is on a distinguished road
Re: Split string, execute function, delete split.

Ok to clarify a little further, the morse came from machine generated transmissions. these were remote sensing units that reported a set string of 45 characters each session.

The units used 3 letters (D, S and U) to declare detection type (D) state (S) and unit (U). these are all 3 letter combinations in morse.

by sifting out these three letters and recording it's place in the string I can the go back and manually separate out the desired sessions.

The code I intend to run involves an IF loop. eg:

If strMorse = U then
'check rest of string
end if
if strMorse = D then
'check rest of string
end if


and so on.

so long as I have a record of sessions the rest can be done manually for the short term.

the receiving software was not good for recording pauses shorter than 30ms which resulted in the garbled text files I have now.

As I cannot replicate the events that created the data, I need to find a way to split it all up. - hence the database.
Dranoweb is offline   Reply With Quote
Old 09-29-2009, 05:22 AM   #12
Atomic Shrimp
Humanoid lifeform
 
Join Date: Jun 2000
Location: Portsmouth, England
Posts: 1,954
Thanks: 0
Thanked 8 Times in 7 Posts
Atomic Shrimp has a spectacular aura about Atomic Shrimp has a spectacular aura about
Re: Split string, execute function, delete split.

But are you saying that these codes D, S and U may appear anywhere within the string?

If so, haven't you still got a problem, because, for example, you might see the sequence -.. in there and decide this is a D, when in fact it may be any of the following:

TEE
TI
NE
TE plus the left part of F, H, I, J, L, P, R, S, U, V or W
T plus the left part of F, H, S, U or V
EE preceded by the right part of A, J, K, M, O, Q, T, U, V, W, X or Y
E preceded by the right part of C, F, G, P or R
I preceded by the right part of A, J, K, M, O, Q, U, V, W, X or Y
The last part of A, J, K, M, O, Q, T, U, V, W, X or Y followed by the first two parts of F, H, S, U or V
The last two parts of C, F, G, P or R followed by the first part of F, H, I, J, L, P, R, S, U, V or W

So when you see -.. in the unbroken string, it might be a D, or it could be one of 163 other things (so statistically, it's most likely not a D at all)
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- it's not radioactive, and contains only a few crustaceans.
Atomic Shrimp is offline   Reply With Quote
Old 09-29-2009, 01:46 PM   #13
Dranoweb
Newly Registered User
 
Join Date: Sep 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Dranoweb is on a distinguished road
Re: Split string, execute function, delete split.

Ok, to elaborate further, If I were to translate a string it would read:
(I had wanted to keep this a little secret, but i'll be changing the system entirely due to my current problem)
D00007iS00008iU00009i
While there are more complex variations this would mean:
Detection type 1 (motion),
I (successfully initiated next function),
State 2 (level 2 motion on a scale of 4),
I
Unit number 3
I



As numbers are all 5 digits long , and given when they are broken into groups of three, no numbers used equate to D, S, or U.

The numbers 7,8,9, and 0 only are used to avoid misinterpretations.

The numbering system works a little like roman numerals:

00007 = 1
00008 = 2
00009 - 3
90000 = 4
00070 = 5
00080 = 6
00090 = 7
99000 = 8
00700 = 9
00800 = 10

Except for 4 and it's multiples (preceeded with 9) they just add to each other.

The need for extremely high numbers is limited, hence the issues with multiples of 4.

however if they are required one can avoid the use of multiples of 4 to achive the higher numbers.

However, keep in mind that this system is being replaced anyway. I'm planning of going to something more suitable like RTTY.

etc.


I had considered what may happen if my information was broken or not fully readable (which has happened) and designed the system to allow for errors.

Last edited by Dranoweb; 09-29-2009 at 03:38 PM. Reason: Edited due to typos.
Dranoweb is offline   Reply With Quote
Old 10-01-2009, 02:42 PM   #14
Atomic Shrimp
Humanoid lifeform
 
Join Date: Jun 2000
Location: Portsmouth, England
Posts: 1,954
Thanks: 0
Thanked 8 Times in 7 Posts
Atomic Shrimp has a spectacular aura about Atomic Shrimp has a spectacular aura about
Re: Split string, execute function, delete split.

Crikey, I'm completely lost now.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- it's not radioactive, and contains only a few crustaceans.
Atomic Shrimp is offline   Reply With Quote
Old 10-01-2009, 02:46 PM   #15
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,829 Times in 1,579 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Re: Split string, execute function, delete split.

Quote:
Originally Posted by Atomic Shrimp View Post
Crikey, I'm completely lost now.
I was lost a lot sooner...

I don't think I'm one to help on this one. This is beyond where I want to go.

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cascading delete related records Big Pat Forms 6 04-10-2009 09:33 PM
i've got a little 'add image' problem too... wiklendt Forms 7 12-22-2008 12:11 AM
quick question on modules/procedures/functions/sub Cire Modules & VBA 8 05-25-2006 11:38 PM
Working with an ini file doulostheou Modules & VBA 3 08-21-2002 06:14 AM
Split Database goaksmith General 4 08-16-2002 07:02 AM




All times are GMT -8. The time now is 03:40 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World