Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Text boxes updated automatically by Combo Box

Status
Not open for further replies.

Anaheim23

Technical User
Jun 29, 2006
8
US
Hello,

I've searched through all the threads and I just can't seem to solve this issue:

I need to text boxes to update correctly after a selection is made in my combo box.

Table1: Invoice
PrimaryField: InvoiceID || Property: Autonum

Table2: InvoiceExp
PrimaryField: ExpenseID || Property: AutoNum
Field: InvoiceID || Property: Text
Field: VendorID || Property: Number
Field: ConsultantID || Property: Number

Invoice.InvoiceID has a one to many relationship with InvoiceExp.InvoiceID

In the InvoiceExp table, for the field InvoiceID, I designated it as a combo box with the Table/Query that does the following:

SELECT tblInvoice.InvoiceID, tblInvoice.InvoiceNum, tblVendor.VendorCompName, tblConsultant!ConsultantFN & " " & tblConsultant!ConsultantLN AS Consultant FROM tblVendor INNER JOIN (tblConsultant INNER JOIN tblInvoice ON tblConsultant.ConsultantID=tblInvoice.ConsultantID) ON tblVendor.VendorID=tblConsultant.VendorID;

In my form, frmInvExp, the combo box "InvoiceID" has the following under the AfterUpdate event:

Private Sub InvoiceID_AfterUpdate()
Me![InvoiceNum] = Me![InvoiceID].Column(1)
Me![VendorID] = Me![InvoiceID].Column(2)
Me![ConsultantID] = Me![InvoiceID].Column(3)
End Sub

However, in my form, instead of the Name of the Vendor, it displays the VendorID number, and instead of the Name of the Consultant, it displays the ConsultantID number. What did I do wrong?


 
How are ya Anaheim23 . . .

For starters . . . the relationship [blue]Invoice.InvID[/blue] [purple]as AutoNumber[/purple] is an [blue]automatic type mismatch[/blue] with [blue]InvoiceExp.InvID[/blue] [purple]as Text[/purple]

[blue]Your thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi, Anaheim23,

By any chance, have you defined any of the fields in your tables as lookup fields? If so, beware the perils of evil lookup fields... what is displayed is not necessarily the same as what is stored, and could produce the results you describe.

HTH,

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top