Can I change the default value of a control?

G

Guest

I have a form which has a number of controls where the control source is a
DLookup statement, eg the value of txtSurname is a DLookup which compares a
membership number on the form with the membership number in a table and then
returns the equivalent surname. However there are times when I don't have a
membership number but still want to input a surname but when I click in the
surname control I can't enter any text. The form is based on a query which
links two tables. can anyone tell me a way around this?
Thanks
Tony
 
C

Carl Rapson

Tony Williams said:
I have a form which has a number of controls where the control source is a
DLookup statement, eg the value of txtSurname is a DLookup which compares
a
membership number on the form with the membership number in a table and
then
returns the equivalent surname. However there are times when I don't have
a
membership number but still want to input a surname but when I click in
the
surname control I can't enter any text. The form is based on a query which
links two tables. can anyone tell me a way around this?
Thanks
Tony

What I would do is remove the DLookUp from the Control Source of the control
and put it in the Form_Current event instead:

Me.txtControl = Nz(DLookUp(...),"")

That way, the value is set whenever a record is displayed, but you can also
type in your own value.

Carl Rapson
 
T

Tony Williams

Thanks Carl
Tony
Carl Rapson said:
What I would do is remove the DLookUp from the Control Source of the
control and put it in the Form_Current event instead:

Me.txtControl = Nz(DLookUp(...),"")

That way, the value is set whenever a record is displayed, but you can
also type in your own value.

Carl Rapson
 

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