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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with MaskEdbox

Status
Not open for further replies.

NotSoVisual

Technical User
Aug 29, 2003
203
MX
I have an edit mask that looks like this:
##.##.##.##.##

(It is the traditional way that archaeologists represent Maya Long Counts)

The five 2 digit numbers have various ranges. When the user is finished with the entry (press cmdEnter) I check to see if the various ranges are correct I notify with msgbox and set the focus back to the editmask.

I would like to set the focus back to the incorrect pair but do not know how. Can you help?
 
This works just add some variables to define where the underscores go and how many sendkeys right

MaskEdBox2.text = Mid(MaskEdBox2.text, 1, 2) & ".__." & Mid(MaskEdBox2.text, 7, 8)

MaskEdBox2.SetFocus
SendKeys "{home}"
For x = 1 To 3
SendKeys "{Right}"
Next x

Tom
 
Thanks Tom, that worked like a charm. I guess I need to read up on send keys.
I liked the idea of using the mask but didn't like that the user had to wait to finish the whole input to give the message that a pair was entered wrong. Is ther a way to use the edit mask and test as user inputs?


 
Sure, play around with the sub Maskedbox1_change. Analize the value there then if it is wrong prompt the user with a message box then run the previous code. Also Maskeditbox1_validate is a good sub but to verify as data is entered use the change sub.

Tom
 
Thank-you again Tom. You gave me thought. I did what you first said and was very pleased to have 'solved' my problem. After cleaning up the code and stripping out the five pairs of numbers I realized that I could do all if I changed the mask into 5 masks, one for each pair. No need to strip and could correct/notify on the fly with no xs effort.
FYI the Maya Long Count is what I am referencing. The LC is a 5 digit number in the form a.b.c.d.e where the values of the places are
letter called PositionValue Range
e Kins ones 0-19
d Uinals 20 0-17
c Tuns 360 0-19
b Katuns 7200 0-19
a Baktuns 144000 0-13

This 5 digit number is used to count ELAPSED days(kins) from an initial start date.
So my birthday would be represented by 12.16.3.8.5 or 1,844,445 days after their start day. If their start day came on julian day number 584,285 when was I born?

Care to come up with a general FN(s) to derive gregorian from any LC a.b.c.d.e and the other way. Please do not look up on the web. I have my own and only offer as an exercise.


 
>>I guess I need to read up on send keys

Not really! I would not use SendKeys to do what you're wanting. Check into the SelStart and SelLength properties of the Mask Edit Control.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top