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

Edit masks

Status
Not open for further replies.

girls3dog1

Programmer
Nov 22, 2002
30
US
PB10.5
MSAccess

I'd like to save the edit mask characters to the database when I a save the column data. The edit mask has the following format: XXXX-XXXXXX-XXXX-X. The saved column data would look like the following: 1234-123456-1234-1. Can anyone suggest how I can save the mask characters with the data?
 
hi
Code:
em_1.text = '123412345612341'

//1?Declare
Long ll_StartPos = 1

String ls_OldChar, ls_NewChar, ls_Mask


//2?Get The EditMask's Mask And Replace "X" to "@"
ls_Mask = em_1.Mask

ls_OldChar = "X"

ls_NewChar = "@"

// Find the first occurrence of ls_OldChar.

ll_StartPos = Pos(ls_Mask, ls_OldChar, ll_StartPos)

// Only enter the loop if you find ls_OldChar.

DO WHILE ll_StartPos > 0
	
	// Replace ls_OldChar with ls_NewChar.
	
	ls_Mask = Replace(ls_Mask, ll_StartPos, &
		Len(ls_OldChar), ls_NewChar)
	
	// Find the next occurrence of ls_OldChar.
	
	ll_StartPos = Pos(ls_Mask, ls_OldChar, &
		ll_StartPos+Len(ls_NewChar))
	
LOOP

//3?Format The EditMask's Text
String ls_DispText
ls_DispText = String(em_1.Text,ls_Mask)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top