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!

Text Box Help 1

Status
Not open for further replies.

ianbar

Technical User
Jan 10, 2003
69
GB
I have a form a user completes and I want to use some of the information in another form that is open at the same time.

I need to take the first 3 letters of the first name and insert them into my second form.

I also need the date which is currently in DD/MM/YYYY to be inserted into the second form in this format DDMMYY.

How would I aproach this in VB?
 
If the forms are called frmSource and frmDestination respectively, and the controls are called txtFirstname and txtDate on each form (say), then the following code will do the assignment of the data between the forms:
[tt]
Forms!frmDestination!txtFirstname = left(Forms!frmSource!txtFirstname,3)
Forms!frmDestination!txtDate = Format(Forms!frmSource!txtDate,"ddmmyy")
[/tt]

It might be sensible to place this code in the OnOpen event of the second form, assuming its opened from the first form, and the first form remains open.

Hope this helps,


Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
I have another small problem now, I need to conert a hyperlink field to text. The structure of the hyperlink when converted to text is:

View Form#hyperlinkaddress#

I need to remove everything before hyperlinkaddress and the '#' after it.


Any ideas?
 
One way is to use the string functions.

If there is a fixed number of characters before the #, use
Mid(originalstring,startposition,length)

If the number of characters at the start are not fixed, use the instr() function to locate the first #, and find out what character number that is. Then use mid() to remove all characters up to an including that number. Then do the same thing at the end of the string.

The result will be a string you can enter in to a text box.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top