5
Dim sort_slots_sql As String
sort_slots_sql = _
    "select date, part, service, slot" & _
    " from ass_slots, ass_occasions" & _
    " where ass_slots.occasion = ass_occasions.occasion" & _
    " order by slot, service, date, part"
Set slots_rst = db.OpenRecordset(sort_slots_sql)

This gives a too few parameters error. One is expected. On another place in the code, there is an almost identical situation but there, two parameters are expected!

1 Answer 1

5

I can't say conclusively, but I am 99% sure the problem is that you have included a field name in that query that doesn't exist in the table. Check all the fields names and make sure they are spelled exactly like they are in the table.

Also the "Date" field is a likely suspect since it is a reserved word in Access. I'd suggest not naming a field "Date". However, if you are stuck with that name, surround it with square brackets in all your queries like so:

Dim sort_slots_sql As String
sort_slots_sql = _
    "select [date], part, service, slot" & _
    " from ass_slots, ass_occasions" & _
    " where ass_slots.occasion = ass_occasions.occasion" & _
    " order by slot, service, [date], part"
Set slots_rst = db.OpenRecordset(sort_slots_sql)
Sign up to request clarification or add additional context in comments.

4 Comments

Correct, in one of the tables a column was named "datum" (Swedish for date). Thanks a lot!
You bet. Seen that error a million times. Good luck with your app.
Wow you have seen a lot of errors. Have you ever seen the one about "Too many double entendres" ? ;)
@onedaywhen Err number 69, perhaps?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.