filling textboxes with records

  • Thread starter enrico via AccessMonster.com
  • Start date
E

enrico via AccessMonster.com

i have a combobox that the source is from a data of one of my tables. how do
i automatically fill my two textboxes with records everytime i choose a data
from my combobox?

e.g.
table Client
Client
Position
Address

combobox = Client
everytime combobox is filled with a particular client, textbox1 will be
filled by the client's corresponding position and textbox2 with the client's
address.
 
S

strive4peace

Hi Enrico,

what you need to do is make textbox controls:

Name --> Position
ControlSource--> =combo_controlname.column(1)


Name --> Address
ControlSource--> =combo_controlname.column(2)

WHERE
combo_controlname is the NAME property of your combobox control

column indexing starts at zero -- so column 1 is really column 2 <smile>

I am assuming that the RowSource for the combo is this:

SELECT Client, Position, Address FROM Client ORDER BY Client

and the ColumnCount of the combo is set to 3


Warm Regards,
Crystal
remote programming and training

Video Tutorials on YouTube!
http://www.youtube.com/user/LearnAccessByCrystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
E

enrico via AccessMonster.com

thank you, it worked. but why does the column interviewer doesn't show? only
the position ans address
 
S

strive4peace

Hi Enrico,

you're welcome

You can change the RowSource to add another column --> click on the
builder button [...] for the RowSource. Add whatever columns you want

change the ColumnCount property to the number of columns you have

Change the ColumnWidths property to assign a width to each column,
delimit with ;

Change the ListWidth property to be the sum of the Column widths + 0.2"
allowance for a scrollbar


Warm Regards,
Crystal
remote programming and training

Video Tutorials on YouTube!
http://www.youtube.com/user/LearnAccessByCrystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
E

enrico via AccessMonster.com

thank you! it did really help. can i do the same with a query? for example,
every time i click my search button i want my results to be shown in
textboxes(1 result per textbox). is it possible?
 
S

strive4peace

Hi Enrico,

you are welcome,

yes, the RowSource can be a Table, an SQL Statement, or a Query

Make sure you set:
ColumnCount
ColumnWidths
ListWidth

then, in another textbox on the form, you may echo any of the column
information like thie:

= combo_controlname.column(#)

WHERE
combo_controlname is the Name property of the combo
# is the column index, starting with zero

if the combo name is ambiguous, like combo 345, change it! The name is
whatever YOU want it to be since that is how you will refer to it --
make it meaningful.


Warm Regards,
Crystal
remote programming and training

*
:) have an awesome day :)
*


Learn Access on YouTube!
http://www.youtube.com/user/LearnAccessByCrystal


Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace
 
E

enrico via AccessMonster.com

you mean i still have to create a combobox for the results and throw it on my
textboxes? how can i relay the results from my button to the combobox?
 
Top