Default Value Question

B

Bill

I am trying to figure out how to set the default value of
a field called email. I want the default value to be
pulled from the inputed data in a field called username
in the same table...

I don't really know how to explain it but here is an
example

You input the (username) of "hello"

after you input this username the default value of the
field (email) is autofilled with hello"@yourdomain.com"

can anyone help. Thanks in advance.
Bill
 
T

Tim Ferguson

I want the default value to be
pulled from the inputed data in a field called username
in the same table...

But a DefaultValue is used when the record is empty, so it couldn't really
lookup a value in another field, could it (because the other field would
still be empty too)?

You can do this on a form, using the AfterUpdate event of the control
attached to the UserName field, something like

Private Sub cboUserName_AfterUpdate()

' don't transfer nothing!
If IsNull(cboUserName.Value) Then
' do nothing

' make sure the user hasn't already entered a
' mail address
ElseIf Not IsNull(txtEmailAddress.Value) Then
' do nothing

Else
' copy value
txtEmailAddress.Value = cboUserName.Value

End If

End Sub


HTH


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top