Runtime error 3131(brewdog)

I am getting a runtime error in the code behind my combo box in the AfterUpdate Event Procedure.

This is my line of code:

Me.RecordSource = "select * from Join where GroupID = " & cboGroup

Join is my table name and GroupID is the number id of group/dept

I am however getting this error when I select a group/dept from the combo box cboGroup:

Runtime error 3131  Syntax error in from clause
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Me.RecordSource = "select * from [Join] where GroupID = " & cboGroup

Join is an SQL reserved word, so you must set it off with brackets.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eh! this question even has my name in it. :o) I don't think BrianWren has enough work to do . . .

His suggestion is the first thing I noticed, too, Kristin. You'll notice that in the DB I sent you, I named all of my tables starting with tbl. I do that for two reasons:

1. When looking at a list of objects, I immediately know what kind of object it is: tbl is table, qry is query, frm is form, cmd is command button, etc. When you start working on larger apps, this kind of naming convention will seem integral to you.

2. There are a lot of words Access doesn't like anyone else to use: Join, Name, Filter, Type, etc. By putting the "tbl" in front of my table, I can give them "reserved" words that describe what's in the table without Access choking on them. (Any reserved word will need to have brackets around it, as Brian says.)


P.S. in future, you can e-mail me with followup questions like this. If they get tricky or if I'm very busy, I'll let you know and you can post them out here. This one probably wasn't worth 100 points, though. :o)
kristincaAuthor Commented:
Whoops! My mistake.  Thanks Lots.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

First question I've gotten in 2 days!  Beware, it's a drought....
drought? Is that why I see your comments on just about every question I look at? You'd think that a rapid rise from not-even-on-the-top-15-list to almost-number-10 would be enough for you . . .
The world is not enough . . .  (<Place maniacal laughter here>)
Thanks, Bond.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.