Solved

Data Combo Question (how to make it work like a combo in acces)

Posted on 2002-04-24
3
166 Views
Last Modified: 2010-05-02
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 :(
0
Comment
Question by:joyrider
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
asafmm earned 100 total points
ID: 6967750
Dear joyrider

FIRST - make sure that your data source are well set (readonly for the cartype and dynamic for the cars).

SECOND - set the data combo properites as follow :
    DataSource - the cars RS
    DataField - the CarTypeID field from the cars RS
    RowSource - the CarsType RS
    BoundColumn - the CarTypeID field from the CarTypes RS
    ListField - the CarTypeName field from the cars RS

THIRD - it is not good to keep the CarTypeID and CarTypeName in the cars table (unless the values in the CarTypes table my change) because it is redundent !!!

Thanks
Asaf
0
 

Author Comment

by:joyrider
ID: 6968408
That doesn't work !
That's how i had it set , except for the Readonly for cartype and dynamic for cars(ure talking bout locktype & cursortype here right ?), but i changed that and it still doesn't work, yes when u see the default value and yes u can select others from the combo but no it doesn't save and no u can't call requery with out gettin an error

ow and i didn't have cartypename in my cars table, think i must have explained it wrong somewhere

btw could this bug be a cause why it's not working correctly :
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q251225
?
0
 

Author Comment

by:joyrider
ID: 6968528
Okay i tested it with the ADODC control and there it seems to work so it has to be something with my code (i'm not using the adodc control)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now