-
too few parameters. expected 1.
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
Asus A7v8x
Amd XP 2700+
Kingston 512mb Pc3200
Asylum Geforce 4 ti4200 128mb ( bentch at 11829 not o/c)
Sound Blaster Audigy 2 Platinum
Maxtor 80Gb with 8mb buffer ATA - 133
Sony DVD-rom 16x
Samsumg 52x Burner with 8mb cache
400W PS
SLK-900u + Panasonic 92mm fan
and lot of fans
Windows xp Pro SP1
-
Ultimate Member
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
-
Ultimate Member
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.
-
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.
-
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.
-
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
Asus A7v8x
Amd XP 2700+
Kingston 512mb Pc3200
Asylum Geforce 4 ti4200 128mb ( bentch at 11829 not o/c)
Sound Blaster Audigy 2 Platinum
Maxtor 80Gb with 8mb buffer ATA - 133
Sony DVD-rom 16x
Samsumg 52x Burner with 8mb cache
400W PS
SLK-900u + Panasonic 92mm fan
and lot of fans
Windows xp Pro SP1
-
Ultimate Member
lol, I'm doing something the same in Java
Stefan
if I can't get mine working I aint helping you
-
Banned
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|