beer-monkey.com
|
Posted: 01/28/2002, 3:05 AM |
|
I have a quick question for you guys, i have a field in the .asp called 'contact_id' which displays the 'contact' description which is an email address i.e. 'hounslow.education@primetime.co.uk'
However is it possible to just display the 'hounslow.education' part leaving off the '@primetime.co.uk' ??? This will be used as a reference for the record?
Thanks in advance
p.s. I am using ASP and MySQL
|
|
|
Nicole
|
Posted: 01/28/2002, 5:31 AM |
|
Hello,
you can copy the part of the string and display it as field value. Use InStr and Mid functions, e.g.:
pos = InStr(fldcontact_id, "@")
if not isEmpty(pos) then
fldcontact = Mid(fldcontact, 1, pos)
end if
|
|
|
beer-monkey.com
|
Posted: 01/28/2002, 6:12 AM |
|
Nicole,
You really are a star you know.... however, where does this script need to go and is the example you gave going to work directly or are there parts i will need to tweak?
Thanks again hun
|
|
|
Nicole
|
Posted: 01/28/2002, 6:15 AM |
|
The code should be added to BeforeShow event (sorry, forgot to mention it:))
It's almost cut'n'paste. The only thing that may be changed is field name. I used "contact_id". Use the field name you've added to the form.
|
|
|
bee-monkey.com
|
Posted: 01/28/2002, 6:29 AM |
|
Nicole,
This doesn't seem to be working the field is 'contact_id', but it displays 'contact' and it is the 'contact' part i want to shorten from:
hounslow.education@primetime.co.uk
TO
hounslow.education
I added your script as is to the Before Show Event and nothing seems to happen... have you any ideas why? :) please pretty please.....
|
|
|
Paul
|
Posted: 01/28/2002, 6:36 AM |
|
Nicole,
I've managed to get it displaying hounslow.education@ how do i get it to knock off the @ too?
|
|
|
Nicole
|
Posted: 01/28/2002, 6:39 AM |
|
use
Mid(fldcontact, 1, pos-1)
|
|
|
Paul
|
Posted: 01/28/2002, 7:07 AM |
|
Nicole,
Yet again you have saved my skin.... thanks a bunch
Paul (aka beer-monkey)
|
|
|
|