 |
 |

12-07-2002, 08:59 AM
|
|
|
problem setting the current value to display for my combo box..
|
Hello. right now what i do is open a record set to a table with all the values in that i want to put into the combo box's List.
for example, tbALLtown, and i put all Town fields in there.
Then i close that record set, and open a new one with an sql linking to the customer ID. so its like WHERE customerID = (variable). sort of thing
my problem is that i want to fill up the combo and then put its current value to the current customer when the form loads only using one record set because as you could imageon, opening up all the record sets is slowing down my database a lot.
i cant specify which record i want the combo to be and then fill it up because then i will only have one value in my combo box if you know what i mean.
is there anyway to get around this?
gman said before he had to go i should use .ITEMDATA but i did some research and cant find anything on how to use it.
sorry if you dont know what im talking about, hehe cant explain it very well.
-coogie
|
|

12-07-2002, 09:48 AM
|
|
Iron-Fisted Programmer
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
|
|
|
Ok, so the combobox has all the possible values. You need to set
the combo style = 2. Then, after you have loaded the combobox
(using additem), set its DataSource = theRecordsetForCustomers
and make the DataField = "TownID" (or whatever the field is
called in your customer table. When you have a row selected, it
will pull up the current town, but you can pull down the box and
select a new one. If you aren't using bound controls, there is
another way. Just set the text property of the combobox to the
value of the current town. If the town is changed, you will have
to copy the value back to the recordset before update.
|
|

12-07-2002, 11:35 AM
|
|
|
|
alright cheers thinker ill give it a go
im not using data controls btw
|
|

12-07-2002, 11:41 AM
|
|
Iron-Fisted Programmer
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
|
|
|
Doesn't matter if datacontrol or not. You can still bind regular
controls to a recordset object.
|
|

12-08-2002, 03:25 AM
|
|
|
|
is that a bad thing to do or does it not really much difference>
|
|

12-08-2002, 09:48 PM
|
|
Iron-Fisted Programmer
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
|
|
|
If you know what you are doing, it is really much better not to
bind controls. There are some situations where it really isn't
going to make any difference, and it can save some code. But I
would strongly encourage anyone to learn how to do database
programming without relying on automatic binding.
|
|

12-09-2002, 01:28 AM
|
|
|
|
i think what im going to do now is include my combos in the sql for that tab page. because it wont be too big an sql seeing as its one tab page instead of about 3 now. and there wont be ambigious joins because Contacts etc are on different pages.
but i will still open a new recordset to fill each combo then close it, because this way i can do ORDER by for each combo, and it will be much smaller record sets for it to go from BEF to EOF while its filling up the combo.
i dont know how to use data controls ive been trying to do it manualy from day 2, when i think it was you who told me not to. heh thanks thinker
-coogie
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|