Default value from a Query

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

I have a database that will go out to all our reps. They will fill it
in them email back the relevant tables to head office, where they will
all be pulled into one database.

The main input form had a field for the rep to input their name. Since
this will be the same all the time for an individual rep I want it to
default to their name.

To do this I have a table will all the reps names on it. The rep simply
puts a tick in a box (True/False field) net to their name.

Unfortunately I can't get the main for to pull their name in to the
relevant field.

Has anybody got any ideas how I can do this?

Yours desperately (before I pull all my hair out)

Keith
 
Keith said:
I have a database that will go out to all our reps. They will fill it
in them email back the relevant tables to head office, where they will
all be pulled into one database.

The main input form had a field for the rep to input their name. Since
this will be the same all the time for an individual rep I want it to
default to their name.

To do this I have a table will all the reps names on it. The rep simply
puts a tick in a box (True/False field) net to their name.

Unfortunately I can't get the main for to pull their name in to the
relevant field.

Has anybody got any ideas how I can do this?

Yours desperately (before I pull all my hair out)

Keith

Use the Current event of the form to set the value of the reps textfield
in conjunction with DLookup. Are you storing the reps name or the reps
ID? Let's assume ID in this scenario.

Private Sub Form_Current()
txtRepID = DLookup("[RepID]","[tblReps]","[DefaultRep] = True")
End Sub

Adjust the field names. You can choose to return the name instead.

This will make the value of the textbox be the value of the Dlookup
everytime you go to a new record.
 

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

Back
Top