MyBB Community Forums

Full Version: Some help with delphi, databases and dblookupcombo boxes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know it is unlikely but on the off chance that someone here is good with delphi i have a small problem.

I have a dblookupcombo box (a db drop down box) and it selects the row of an access database which is then displayed in a series of dbedit boxes. Obviously my key field is set to the index of the dblookupcombobox etc.

What i need is a way of selecting a row (preferably through the dblookupcombobox) using the program (as in without human interaction with the dblookupcombobox).

I was thinking something along the lines of:
dblookupcombobox1.selected.index:=2;

though i know that wont work (i have tried along with many other combinations) something similar would be good.

I would prefer not to have to change the query or use parameters.

A way of passing variable values between forms also might do.
I haven't used those lists before, but make sure you're trying to set the selected index after the control makes the query. If you're doing it on form load, it may be trying to select the item before the query has been made/list filled up.
Well i just managed (like just then) to solve it using:

users.ADOQuery1.Locate('uid',auser.dbedit1.Text,[]);

I am just having a few minor problems which are frustrating me alot like i am having trouble getting that to work accross forms when i have jsut inserted a record and want to access that record back on my inital form. I am trying things like users.ADOQuery1.requery but i have had no luck so far.

Also i assume have used delphi a bit Zinga, have you noticed that dbedit boxes won't update the database upon direct editing in vista like they should. It works fine in XP but not in vista, any idea how to fix this? I think i got it to work if i had a button with ADOquery1.refresh but i would prefer not to have a button. I suppose it isn't crucial that it works on vista.

If anyone can recondmend a good delphi forum or resource site it would be good as i am having trouble finding documentation for delphi Sad I wish there was a delphi manual or something like php (or i was allowed to use visual basic or visual c++ lol as no one has herd of delphi).
Delphi/PASCAL is probably bigger than you think, but relative to C++, yes, it's quite "unknown".

I haven't used Delphi in about 6 years (last time I used it was for a lame computer scholarship class), and certainly never used these "auto DB controls".

Why can't you use Visual Studio? Not installed?
No i have visual studio but it is for school and they use delphi Sad and i am doing stuff way past what i am suppose to be doing (we are meant to be using text files but i am using a database instead) so the teacher can't offer me much help (plus he teaches us of a tutorial anyway).
Eh, do you really have to exceed what you're meant to be doing? If your particular assignment requires you to use text files, you should really do that - for one, they can't give you the grade on how you used text files if you never actually used them...

Anyways, you could always just populate a normal listbox manually...
Oh well apparently databases in delphi is the "hard" topic in grade 12 so i figure it is good practice and i kind of enjoy it anyway. I have found a way to do it anyway now fortunatley so i think that is just about the last of my problems. As for the grade thing, how we store the data has not actually been specified its just that text files are the only way that we have learnt in class so far.