//flex table opened by JP

Click to See Complete Forum and Search --> : too few parameters. expected 1.


civic91dx
04-17-2003, 07:40 AM
i get that error when i run my program to bring up my database and select from a chosen district. this is some of my code:
Private Sub Form_Activate()
Dim ws As Workspace
Dim db As Database
Dim rs As Recordset
Dim sql
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("C:\Documents and Settings\Administrator\Desktop\Data\Information\bo ys.mdb")
sql = "SELECT * FROM SCHOOL WHERE DISTRICT = " & sd & ""

Set rs = db.OpenRecordset(sql) (here is where i get my error)
oh yeah im using vb studio 6 pro

DocEvi1
04-17-2003, 08:16 AM
what you need to do is

type in db.OpenRecordset( and look at the parameters it is asking for. Do the same for Set ws = DBEngine.Workspaces(0) as well.

Stefan

chubtub
04-17-2003, 10:47 AM
I hate it when I get this error because the SQL statement always looks right. So here are just some shots in the dark.

change 'Dim sql' to 'Dim sql as string'

Check to see if 'school' or 'district' are reserved words for vb or the database.

Might want to use trim(sd) in the sql statement just to make sure no extra spaces are hanging around.

bahama llama
04-17-2003, 10:27 PM
I had a similar problem and for some reason it was that I did not have the correct letter case for the table in the database. Ie. my sql said User but the table was user. Once I fixed this no prob. I hope this helps some. Don.:t

AltatemTC
04-17-2003, 10:42 PM
Is the variable 'sd' a string or number? If it's a string you need to wrap it in quotes. Remember a value can be numeric but be stored as a string so look at the database field type to determine whether it's a string or a number.

civic91dx
04-20-2003, 11:08 PM
yeah im still geting the error. can you guys help me to figure this out. ok this is what im tryin to do. open a data base from access that has a school table and it has all the school information from ohio. when i start the program i want it to have a form that has a combo box that when you select the district that you want to view it will jumpo to the other form which show the school information for the shools in that district. the district are Central, East, Northeast, Northwest, southeast and Southwest. thanks
carlos

DocEvi1
04-21-2003, 07:27 AM
lol, I'm doing something the same in Java :D

Stefan
if I can't get mine working I aint helping you :p

qball
04-21-2003, 08:29 PM
form that has a combo box that when you select the district that you want to view it will jumpo to the other form which show the school information for the shools in that district


sounds like the classic client-server filter list deal...

Lot of people ask how to do this thru browser, and rather difficult or kludgy.

Anyway, what you want is a list box that displays choices and a (sub) form that will display info based upon value of list box.

In any client server environment (PB, Access(VBA/VB), Java, whatever...), do just that.

Have window with listbox and form to display info. When window opens, listbox has choices, form is empty (could be used to insert records?). When user chooses from list box, get value and use as argument to display info form. User chooses another value from listbox, re-retrieve the info form.