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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grabbing the text from a DTC dropdown to populate a DTC textbox 1

Status
Not open for further replies.

mnongkhlaw

Programmer
Feb 22, 2002
62
0
0
IN
Dear folks,

I have 2 Recordset DTCs which point to 2 different tables in an MS Access97 database (rs1 to officer, rs2 to office).

I'm using the SOM as well as FormManager DTC.

In my data-entry screen, I have 2 fields, one of which is Office Code, which is a drop down DTC (listbox DTC) which is bound to rs1 but is looking up data from rs2 to display the Office Name for the user to choose from. The bound field is office_code, display field is office_name.

The other DTC is a textbox which I want to populate with the text the user has chosen from the dropdown DTC.

Can anyone explain the easiest way to do this with minimal coding (that's why I used FormManager in the first place).

Mark Nongkhlaw
 
You would want to do this on the client-side (not a server round trip). So you need some JavaScript.

If you have a PageObjectDTC then you can add the following:

function thisPage_onbeforeserverevent(i_sObj, i_sEvent) {
}

If you add this via the script outline, you will need to add in the two parameters - the object name and the event.
You need to add an onchange server-side event handler for the drop-down - but this can be left completely empty.

You can then modify the onbeforeserverevent:

if (i_sObj == 'cmbOffice' && i_sEvent == 'onchange')
{
//copy the combo text to the textbox
document.thisForm.txtOfficeName.value =
document.thisForm.cmbOffice.text(
document.thisForm.cmbOffice.selectedIndex);
// now cancel the server round-trip...
thisPage.cancelEvent = true;
}

or something like that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top