Auto Populate text field

  • Thread starter Thread starter dosima
  • Start date Start date
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
 
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
 
Back
Top