Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use a part of string value!! 2

Status
Not open for further replies.

Fekri

Programmer
Jan 3, 2004
284
IR
Hi,

Finally I found how to connect my database to the serial port which is Weighing Machine to get the Weight value.

But the data which I received is attached in a table.
I know the first 6 number after chr(3)in data which is received repeatly is exactly the weight.

So, I need just make a command to get the 6 number after chr(3) and put in other text box.

Thanks for any help

Fekri


Thanks & Good Luck
Ali Fekri
 
too easy mate,

look into the Mid function. Just type it into a code window and hit F1 :)
 
Thanks for your reply

But there is one problem which I couldn't use Mid and I forget to tell before:

If you see the table in attched, the data which recieved any time are not same. and will start with different part of the value.
So like this I couldn't use Mid to say start from which part of this value, because impossible.

Just the way is, should be some command to tell start reading just 4th cjaracter after first "S" in this value.

Just take a look in the table, I populate different reading of this value which received in different time.

Thanks


Thanks & Good Luck
Ali Fekri
 
TRY
Code:
val(mid("weqweqweSxxxx888554",instr("weqweqweSxxxx666","S")+4))
 
or

val(mid("weqweqweSxxxx888554",instr("weqweqweSxxxx666","S")[red],[/red]4))

?

Can't see any drama with that, are we missing something?
 
JBinQLD:

Freki wants the 4th character after the first "S" not 4 chracrters after the "S
 
pwise: Sorry, i just saw the xxxx in your example and though you'd typo'd. No offense intended mate,

JB
 
Thanks so much

I used it and found should change some things on and finnaly it's ok now.
I bring one of the record here for example:

0S20
03221 0S20
03221 0S20
03221 0S20
03221 0S20
03221 0S20
03221 0S20
03221 0S20
03221 0S2

I changed your method like this: " :chr(3)"

x = Me.Read_Baskool_Data
Me.Text1 = Val(Mid(x, InStr(x, Chr(3)) + 1))
Result: 32210

Actully the weight in weighing Machine is : 12230

all information which I get is like this and I have to use some method to change the number too.
Do you have any idea for this too???

Thanks for your help


Thanks & Good Luck
Ali Fekri
 
Perhaps this ?
Me.Text1 = StrReverse(Mid(x, InStr(x, Chr(3)) + 1, 5))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top