Still need help with Access DB Query!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is continued from yesterday. I am still at the point of getting the
3709 error. Thought it would be easier to just copy and paste what had been
done so far. Still needing help with this one.

History is below:


Still not working, but different symptoms. If I use the three quotes, I get
a syntax error, but two quotes seems to be ok with syntax. Now when the line
executes I get the following error:

3709 - The connection cannot be used to perform this operation. It is
either closed or invalid in this context.

Again, the code in sample 1 works, but brings back everything from the DB.
I never
imagined it would be so hard to get something out of Access through Excel!
 
rs.Open "Select *FROM tblDoctorBladesQuery WHERE
tblDoctorBladesQuery.MachineLocation = """ & cboMachineLocation.Value""""
,

should be

rs.Open "Select * FROM tblDoctorBladesQuery WHERE
tblDoctorBladesQuery.MachineLocation = """ & cboMachineLocation.Value & """"
,

I would think.

--
Regards,
Tom Ogilvy


Vince said:
This is continued from yesterday. I am still at the point of getting the
3709 error. Thought it would be easier to just copy and paste what had been
done so far. Still needing help with this one.

History is below:


Still not working, but different symptoms. If I use the three quotes, I get
a syntax error, but two quotes seems to be ok with syntax. Now when the line
executes I get the following error:

3709 - The connection cannot be used to perform this operation. It is
either closed or invalid in this context.

Again, the code in sample 1 works, but brings back everything from the DB.
I never
imagined it would be so hard to get something out of Access through Excel!
cboMachineLocation.Value",cn,adOpenDynamic,adLockOptimistic,adCmdText
 
Thanks Tom,
Access queries seem to be extremely finicky with the syntax. The second "&"
and the added quotes took care of it. Thanks so much.
 
Vince said:
Access queries seem to be extremely finicky with the syntax.

All SQL parsers are <g>. You may or may not prefer this approach:

"SELECT * FROM tblDoctorBladesQuery" & _
" WHERE tblDoctorBladesQuery.MachineLocation" & _
" = " & Chr$(34) & cboMachineLocation.Value & Chr$(34)

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top