PDA

View Full Version : querying access databases


marsoa5
01-04-2007, 10:02 PM
Hi guys, quick question for you. I have a access database and right now its not doing what i want it to do. I would like it to add the contents of column "Question" to listbox names "answers" but i need it to do it depending on the Model selected from a combobox. I cant tell what is wrong in this code, it seems the string that is pulling the text from the combobox may be stopping the query... any ideas on this?

Model = ComboBox.GetText("Model");


strDbPathAndName = "AutoPlay\\Docs\\Customer Service.mdb"
DBOpen("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="..strDbPathAndName)

DBExec("select "..Model.." from Questions")
t = DBRow()
while t.Question do
ListBox.AddItem("Answers", t.Question.. "");
t = DBRow()
end



thanks
:)

Dermot
01-04-2007, 10:29 PM
Try this

DBExec("SELECT Question FROM Questions WHERE Model = '"..Model.."'" )

marsoa5
01-05-2007, 05:59 PM
Dermot
thanks!! it worked!!
Dermot to the rescue!!

:)