DrivenTooFar
Posts: 10
|
| Posted: 01/28/2007, 6:48 AM |
|
I am trying to use the Before Insert Event to modify some text before I insert it into the database. What it is supposed to be doing is taking the string and removing anything in it that isn't a number. I'm pretty sure the Formatting function is right but when I try to do the Before Insert command nothing happens. Syntax is fine but it just doesn't Insert anything into the database. Here is the code:
Function frmMain_BeforeInsert(Sender) 'frmMain_BeforeInsert @2-2DE5EEA1
'Custom Code @43-73254650
' -------------------------
Dim strHome, strWork, strOther, strSocial
strHome = frmMain.HomePhoneNumber.Value
strWork = frmMain.WorkPhoneNumber.Value
strOther = frmMain.OtherPhoneNumber.Value
strSocial = frmMain.SocialSecurityNumber.Value
strHome = FormatPhoneNumber(strHome)
strWork = FormatPhoneNumber(strWork)
strOther = FormatPhoneNumber(strOther)
strSocial = FormatPhoneNumber(strSocial)
frmMain.HomePhoneNumber.Value = strHome
frmMain.WorkPhoneNumber.Value = strWork
frmMain.OtherPhoneNumber.Value = strOther
frmMain.SocialSecurityNumber.Value = strSocial
' -------------------------
'End Custom Code
End Function 'Close frmMain_BeforeInsert @2-54C34B28
Does anyone know what I am doing wrong? If you need it, I will post the format function. Thanks.
|
 |
 |
csierra
Posts: 123
|
| Posted: 01/30/2007, 12:33 PM |
|
Try Sender.OtherPhone.... instead of frmMain.OtherPhone;
change frmMain to Sender
_________________
Yes! I Can!!! |
 |
 |
|