Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2006
    Posts
    59

    Unanswered: updation in form text box

    hello
    i have a table in which general information about clients is stored e.g code , name etc, i have a form which is retreiving information through combo boxes from different tables and storing it into a newer table.. As storing both the code and name again and again is not required i call only the code using combo . wht i want is a tex box field which just shows the name of the clients as its code is entered so that it would be convenient to the user for data entering. can somebody please tell me how to do it . thankyou

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    a dlookup maybe appropriate
    to use the dlookup function you will need to call it from code attached to an event.

    to give a fuler answer we would need to have a clearer understanding of when you want to display the value in the text box (ie what triggers the requirement to display a vlaue in the text box).
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2006
    Posts
    59
    basically my program is about stocks buying and selling .. so i store clients information in one table and call the code from there to the form in which i store the clients buyng and selling info.. i want to create a texbox which will show me the clients name when i select one from the combo box.. say my client code is 'OJS' and client name is OMAR JUNAID so if i select 'OJS' from the combo i want the name OMAR JUNAID to appear in the text box just for viewing it on form .

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so you have 2 options

    A means of querying the client table when the combo box changes / clicks -t his can be doen as a dlookup() or recordset query

    OR

    Build the clients name as part of the combobox and display the value when its clicked -you can store & retrieve more than just the index column and display value in a combo box's recordset.

    In eitgher case you are going to have to put some code behind the combo boxes on click & possibly on chnage events.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Feb 2006
    Posts
    59
    can u tell me how . and can i change the view of form from datasheet to form view by double clicking a field

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    create a function called, say udfGetClientName
    parameters in fucntion is the client id to look fo, the value returned is the client name(assuming that you have a single client name). If not then you will need to write soem SQL to accquire the name, or alter the recordsource in the combobox.

    Code:
    public function udfGetClientName(lngClientID as long) as string
    udfGetClientName=DLookup("[<mycolumnclientsname]", "<myclienttable>", "[<myclietnID] =" _
         & Forms![<myformname>]!<mycomboboxname>)
    'might be worth looking at the helpfile to find out what Dlookup does
    end function
    then call that function from various events that occur, using the appropriate syntax:
    <myclientnamecontrol>=udfGetClientName(<myparamete rcontainingtheclientID>)

    You need to ask yourself when do you want to set this value
    on change of record if so place it in the forms on current event : <myclientnamecontrol>=udfGetClientName(<myclientID >)
    on change (change) in combobox: <myclientnamecontrol>=udfGetClientName(<mycombobox >)
    on selction (click) in combobox: <myclientnamecontrol>=udfGetClientName(<mycombobox >)
    etc....
    have a look at the help file for the events
    HTH
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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