Re: Writing data from a table to another

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




Hi,
it works, Robin, thanks.
However I'd like to use a textbox in place of a combobox, because this field
should not be editable by operator, and even if I disable it from properties
the down arrow remains visible and it's not so elegant.
How can I use the same bindings you suggested for a combobox in a textbox,
if applicable?
Thanks,
Max
"RobinS" <RobinS@xxxxxxxxxxxxxxx> ha scritto nel messaggio
news:EtidnWPktfs6k1vYnZ2dnUVZ_oytnZ2d@xxxxxxxxxxxxxx

Am I reading this right, that the problem is that the DoctorsName is not
stored in the [Listing] table ? Is that the problem you are having?

You need to bind the combobox to the TblPatientsBindingSource for display,
but you need to set the SelectedValue to ListingBindingSource/DoctorName.

If you have the Listing table in a data source, you can just drag the
[doctorname] from the listing table over and drop it on the combobox you
have already bound to the TblPatientsBindingSource, and it will do the
double-binding for you.

You can double-check this in the Code-Behind -- show all files (click the
icon in the Solution Explorer) and look at the myform.designer.vb code for
your combobox. It should have DisplayMember and ValueMember pointing at
TblPatientsBindingSource, but SelectedValue should point at
ListingBindingSource.

BTW, next time you post, please put some paragraphs in your message. Most
people won't read a 35-line paragraph. You'll get more help if you
separate it out better.> Robin S.

Thanks,

Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
"max" <max@xxxxxxx> wrote in message
news:Pfiwh.1753$wO2.600@xxxxxxxxxxxxxxxxxxxxxxxx

Yes Robin, I have a question:
[CUT] I need the items are written in this table in the explicit way (and
actually the DoctorName is not written at all), because then I need to
let operator to perform many queries on it, and he must selects the
doctors and the patients by name, not by an ID.
How can I do this?

Thanks.
Max

"RobinS" <RobinS@xxxxxxxxxxxxxxx> ha scritto nel messaggio
news:bLmdncpYn8BFMVzYnZ2dnUVZ_vShnZ2d@xxxxxxxxxxxxxx

Did you have a question, or are you just sharing?

Robin S.
----------------------------------------
"max" <max@xxxxxxx> wrote in message
news:%H1wh.516$wO2.426@xxxxxxxxxxxxxxxxxxxxxxxx

Hello,
I'm working on an Access db in VS2005. I have a table, called
tblPatients, in which I have three columns: PatientID (primary key),
PatientName and DoctorName. This table is filled with more than 4.000
records. I load this table on a form, I make queries, updates,
deletion, it does work fine. Then I have a second form, in which I need
to display the two main columns from tblPatients (PatientName and
DoctorName), and some more elements: medical visits performed (till 5
in the same day), date, fares for each visit, total amount, and a
discount field. The operator starts selecting the Patients from a
ComboBox, which displays automatically its DoctorsName field; it's fine
because the operator doesn't need to choose manually the doctors! This
form loads a second table, called Listing. The columns in this table
are:
ListingID (primary key), PatientsID, DoctorsName, Date, Fare1... Fare5,
Total, Discount. I need all these elements are written in this second
table.
Well, I have noted that almost all these elements are written, but the
items belonging to "DoctorName", coming from the previous table
(tblPatients), are not physically written in this table, just displayed
(correctly), and the items belonging to "PatientName" are written only
in the "PatientID" form
(numbers). I have used a ComboBox for PatientsName, bounded to:
Data Source: tblPatientsBindingSource; Display member: PatientName;
Value: PatientID; Selected Value: ListingBindingSource - PatientID.
Then I have used a TextBox for DoctorName, bounded to:
TblPatientsBindingSource - DoctorName.
I need the items are written in this table in the explicit way (and
actually the DoctorName is not written at all), because then I need to
let operator
to perform many queries on it, and he must selects the doctors and the
patients by name, not by an ID.
I didn't write any lines of code, all is written by designer.
Thanks

Max
















.



Relevant Pages

  • Re: Writing data from a table to another
    ... So, choosing a patient from a combobox, the Doctor name comes automatically. ... But, because of DoctorName in this form must only be displayed, I'd like to ... use a textbox in place of a combobox; I realize that this is only a display ... the doctors and the patients by name, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Writing data from a table to another
    ... You said the user was going to select the doctor out of the combobox. ... have already bound to the TblPatientsBindingSource, ... (and actually the DoctorName is not written at all), ... the doctors and the patients by name, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Writing data from a table to another
    ... You need to bind the combobox to the TblPatientsBindingSource for display, ... If you have the Listing table in a data source, ... actually the DoctorName is not written at all), ... doctors and the patients by name, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Writing data from a table to another
    ... The short answer is "No." You can't bind a textbox the same way. ... If you want to show the associated [doctorname] in a textbox, however, ... name for a patient that you pass in as a parameter. ... So, choosing a patient from a combobox, the Doctor name comes ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Difficulty with form design
    ... I'm working with diagnoses and problems and need to track this ... information based on a case by case basis (patients). ... The first combobox would list broad caterogies of diagnoses (ie: ... So that now when I change the first combobox, the second combobox ...
    (microsoft.public.access.forms)