Talk About Network

Google





Software > Access Forms > Re: Auto-Popula...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 44658 of 46786
Post > Topic >>

Re: Auto-Populate Info in Textbox when a selection is made in Combobox

by "Graham Mandeno" <Graham.Mandeno@[EMAIL PROTECTED] > Aug 8, 2008 at 12:31 PM

Hi cwAFcontractor

A combo box can have many columns.  The only column that is visible when
the
box is not dropped down is the first one with non-zero width.  However,
the
other columns are available via the Column property.

For example, say you have a combo box with these properties:
    Name: cboAP
    ColumnCount: 4
    BoundColumn: 1
    ColumnWidths: 0cm; ;0cm; 0cm
(notice the width of the second column is blank, so it will use all the
available space)
    RowSource: Select AP_ID, AP_Name, AP_Phone, AP_Email
                        from AuthorizingParties order by AP_Name ;

Now, the AP_Phone and AP_Email columns are in the combo box but they are
hidden (width=0).

You can now place two textboxes on your form:
    Name: txtAP_Phone
    ControlSource: cboAP.Column(2)
and
    Name: txtAP_Email
    ControlSource: cboAP.Column(3)

These will display those fields for the currently selected customer.

Note that the column number starts counting from zero.  Column(2) is the
third column.
-- 
Good Luck  :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand


"cwAFcontractor" <u45335@[EMAIL PROTECTED]
> wrote in message news:8852a56529aab@[EMAIL PROTECTED]
> I'm new to this Access Database world and i'm tasked with creating a 
> database
> to keep track of the inventory in my shop. I'm creating a form that will
> imput information into a table. On this Form there is a section at the 
> bottom
> where you can put the Authorizing information. There is a combo box
which 
> you
> can select the authorizing party (only two as of right now), and two
text
> boxs (one is email of AP and the other is Phone of AP). What i would
like 
> to
> happen is when the AP is selected in the combo box i would like the
> corrisponding email and phone be imput into the corresponding text
boxes.
>
> I have no idea how to start this. I have tried reading a few threads and
> books but can't find exactly what i'm looking for. I have tried to do
the
> afterupdate wizard when you used more then one column in the combo box 
> wizard
> and don't think i did it right because it messed up the combo box and
only
> gave one option with all the info on one line. I also tried writing a vb

> code
> to imput the information but dont think i did that right either because
> nothing happened when i selected the option in the combo box. As long as
i
> have only one column in the combo box it works fine for the combo box
but 
> i
> can't get the info populated. below is the vb code that i used but didnt

> work.
>
>
> Private Sub enterdata_AfterUpdate()
>
> Set Number = Form_COTSRequest.CORPhoneNumber
> Set Email = Form_COTSRequest.COREmail
>
> If CmbCORName = "fn ln" Then
>    Number = "XXX-225-XXX9"
>    Email = "fname.lname@[EMAIL PROTECTED]
"
> ElseIf CmbCORName = "MSgt fn Ln" Then
>    Number = "XX-225-XXX8"
>    Email = "fname.lname@[EMAIL PROTECTED]
"
> End If
> End Sub
>
 




 3 Posts in Topic:
Auto-Populate Info in Textbox when a selection is made in Combob
"cwAFcontractor"  2008-08-07 18:03:26 
Re: Auto-Populate Info in Textbox when a selection is made in Co
"Graham Mandeno"  2008-08-08 12:31:44 
Re: Auto-Populate Info in Textbox when a selection is made in Co
"cwAFcontractor via   2008-08-08 12:54:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 13:56:56 PST 2009.