Auto Populate text field

D

dosima

Hi

i have a court tbale which includes the fields courtname, courtaddress,
courtnumber.
on the form I have a combobox where you select a court name.
i then want the address and number to display automaticallly in a textfield
underneath. a textbox for the courtaddress, and one for the courtnumber.

i need some help on what code needs to be inputted in order for the textbox
to automatically display the correct address when a court name is selected.
thanks
 
S

Stockwell43

Hi Dosima,

I'm sure some of these guys can help better and I am sure they can give you
a more efficient way of doing it but if you only have a small number I would
guess in the OnClick event of you combo box you can use an if...then
statement. Something like:

If Me.yourcourthousenamefield = "your actual courthouse name" Then
Me.courthouseaddressfield = "the actual address of the courthouse"
Me.courthousenumber="the actual courthouse number"

ElseIf Me.yourcourthousenamefield = "your actual courthouse name" Then
Me.courthouseaddressfield = "the actual address of the courthouse"
Me.courthousenumber="the actual courthouse number"

ElseIf Me.yourcourthousenamefield = "your actual courthouse name" Then
Me.courthouseaddressfield = "the actual address of the courthouse"
Me.courthousenumber="the actual courthouse number"

Else
MsgBox ("Incorrect Courthouse Name!!")
End If


Or you might have to add the AND operand in there.

If Me.yourcourthousenamefield = "your actual courthouse name" Then
Me.courthouseaddressfield = "the actual address of the courthouse" And
Me.courthousenumber="the actual courthouse number"

ElseIf Me.yourcourthousenamefield = "your actual courthouse name" Then
Me.courthouseaddressfield = "the actual address of the courthouse" And
Me.courthousenumber="the actual courthouse number"

ElseIf Me.yourcourthousenamefield = "your actual courthouse name" Then
Me.courthouseaddressfield = "the actual address of the courthouse"
Me.courthousenumber="the actual courthouse number"

Else
MsgBox ("Incorrect Courthouse Name!!")
End If
 

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