i am a beginner and working in vb 6.0 as frontend and ms access as backend
hello ! i have following tables
party:- partyid,lastname,firstname,address,areaid,profid
profession:-profid,profname
area:-areaid,areaname
route:-routeid,routeno,routename
routearealink:-routeid,areaid

i am using msflexgrid control to enter/modify/delete party details which includes area and profession also.For that i want to use a moveable combo boxfrom where user can make the selection.
The problem is that the combo box contains the name of the area,
profession where as i want to update the table with their
corresponding ids (areaid,profid). I don't have an idea how to do it
.Please help

Recommended Answers

All 8 Replies

When the user combo_click()s the value is with you. use this combo value to search the database with the where clause. You get the matching records.

Before that make sure that you have established connection to your database, the recordset is fine tuned and opened.

Hi Shweti,

Use this query in ComboBox LostFocus :

Dim sSQL As String
sSQL ="Select * From Party Where ProfID " _
& " ='" & Combo1.Text & "'"

Populate Recordset using the Above Query

Regards
Veena

When the user combo_click()s the value is with you. use this combo value to search the database with the where clause. You get the matching records.

Before that make sure that you have established connection to your database, the recordset is fine tuned and opened.

reply: sir, i think i was unable to explain my problem. I have area,profession as master tables from which the party table is linked.i.e. party table contains the areaid and profession ids which is already in table(selection).combo box contains the name of area and profession as for userfriendliness ( u don't want user to use ids which are to be stored in the party table).now the problem is that i have to update atleast 20-30 records at the same time for updation i.e. i require to update party table with the areaid ,professionid corresponding to the item selected in the combobox.i don't know how to do it.

reply: sir, i think i was unable to explain my problem. I have area,profession as master tables from which the party table is linked.i.e. party table contains the areaid and profession ids which is already in table(selection).combo box contains the name of area and profession as for userfriendliness ( u don't want user to use ids which are to be stored in the party table).now the problem is that i have to update atleast 20-30 records at the same time for updation i.e. i require to update party table with the areaid ,professionid corresponding to the item selected in the combobox.i don't know how to do it.

Shewthi, In the above explanation you have mentioned that the master table is containing area and profession in plain language and the party table containing the ids of both.
But, my dear, how are you going to link these two tables?

See, to link any table with any other, you should have a primary key. That is in you case atleast, one field of each table should have a common value to hold.

I will explain it in another way. Your user select some area and some profession in plain text. These are drawn by you from the master table, right? and now you want to update the party table with areaid and professional id. What for? are you digitizing the area and profession. even if you do, how are you going to find the areaid represent what area in plain text?

Please be some more clear. Don't worry. Take your own time to explain it. I will be around.

Shewthi, In the above explanation you have mentioned that the master table is containing area and profession in plain language and the party table containing the ids of both.
But, my dear, how are you going to link these two tables?

See, to link any table with any other, you should have a primary key. That is in you case atleast, one field of each table should have a common value to hold.

I will explain it in another way. Your user select some area and some profession in plain text. These are drawn by you from the master table, right? and now you want to update the party table with areaid and professional id. What for? are you digitizing the area and profession. even if you do, how are you going to find the areaid represent what area in plain text?

Please be some more clear. Don't worry. Take your own time to explain it. I will be around.

sir , i don't think that we need to link the area and profession table as they are not required as far as i understood. I just want to update party table through msgrid where area of party and profession of the party both are required. and i want to use combo box for selection. But the database design says that we have to update the areaid of the particular area selected and which i think is where the problem is. as i am unable how to deal with it.
sir,actually i am unable to understand what is not understood to u. please be more clear. thanks i hope u can help me!

sir , i don't think that we need to link the area and profession table as they are not required as far as i understood. I just want to update party table through msgrid where area of party and profession of the party both are required. and i want to use combo box for selection. But the database design says that we have to update the areaid of the particular area selected and which i think is where the problem is. as i am unable how to deal with it.
sir,actually i am unable to understand what is not understood to u. please be more clear. thanks i hope u can help me!

I think your basic problem is when the user select an area and a profession from the main table, the corressponding area and profession in the party table is not automaticalli brought on the grid so that you can update them.

Is it the case? then get back to me.

I think your basic problem is when the user select an area and a profession from the main table, the corressponding area and profession in the party table is not automaticalli brought on the grid so that you can update them.

Is it the case? then get back to me.

sir i just want to provide the selection facility not modification in areaname or profession. i think this is what u r asking ?
waiting for reply..

party:- partyid,lastname,firstname,address,areaid,profid
profession:-profid,profname
area:-areaid,areaname
route:-routeid,routeno,routename
routearealink:-routeid,areaid

You have the above tables in your database
are they not correct?
you are also telling that you have a master table containing area and profession.
what is the table name?
(let it be anything now)

Now you want to update/delete/add the party table above by selecting things from your other four tables. Correct?

If that is true, get back to me. It is very simple. Otherwise, I require some more explanation from you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.