CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    Posts
    1

    Access 2 fields in data control

    I have a form in VB6 which includes the following controls:
    DBCombo - to display the AcctDescription
    Textbox2 - to accept the VOLUME transacted
    Textbox5 - to accept the computation for AMOUNT DUE with the formula:
    VOLUME X AccRate depending on the AcctDesc chosen in the
    DBCombo
    These controls are linked to fields in dtaUnload which is the Data Source.

    The DBCombo has AcctDesc as ListField and AcctCode as BoundColumn. Its Row source is dtaRates which is a data control tied up with the TrRates Access table whose fields are:
    AcctCode AcctDesc AcctRate

    A0001 Account1 2.00
    A0002 Account2 2.50
    A0003 Account3 3.00

    How do I access the AcctRate in the data control named dtarates which is not entered by the user but is included as a field in TrRates so I can use it in the Amount Due computation to de displayed on screen?

    I'm a newbie. Please do help. Thanx

  2. #2
    Join Date
    Mar 2001
    Location
    County Durham, England
    Posts
    238

    Re: Access 2 fields in data control

    Hi Pinky,

    I think you just need to access the Data Controls Recordset property, whenyou select the account on the combo the datacontrol should move to that record in the recordset so Something like;

    Code:
    Textbox5.Text = Val(Textbox2.text) * dtaRates.Recordset.Fields("AcctRate")
    should sort it ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured