Data Combo Question (how to make it work like a combo in acces)
Posted on 2002-04-24
Okay this is what i try to do
imagine u got 2 tabels one named cars and one named cartype
cars is linked using FkCartypeId wich holds the id of the record in cartype
so u basicly choose the type out of a nr of types (comming from that table cartype) in the datacombo and then u save the id of the type u choose in the table cars under fkcartypeid.
This i got working without a problem, What i don't can't get to work is the changing of it
so u got both them tables again and there already some records in table cars, and u want to change the cars type for those records also using a combobox
so i want the original one to be seen in the combobox along with the others (in the list) wich u can choose
this is what i did :
i made a recordset for the rowsource of the datacombo (select * from cartype) and set the listfield to cartypename (so u see the typ's name)
ok that's np, now getting the current value for it in the combobox what i did was setting datasource to a recordset (select cartypename,fkcartypeid from cars,cartype where fkcartype=pkcartypeid) and as datafield i choose fkcartypeid and as boundtext pkcartypeid.
now when i run it it works like i wanted it (i see the original selected value in the datacombobox and i could see the other options in the list) but when i change it to another type, it doesn't get saved, and when i try a recordset (the one for the cars table) .update or .requery i always get errors
so my question is how can i get this working ?? like this way it more ore less like it works in access but i want it this way in VB (i'm connecting to mssql server btw)
please help thanks !
c'mon someone must have made something like this it's pretty basic but i just Can't GET IT TO WORK correctly
all i want that it works like in access that's all :(