Run Time Error - 3075

M

Monish

An event that calls a query is returning a run-time error and I can't seem to
figure out why...I am sure it is probably fairly simple, and would appreciate
some help from anyone out there:

Private Sub cmdOK_Click()
DoCmd.OpenQuery "QryRSNoSplitByRep", acViewNormal, acEdit
DoCmd.Close acForm, "FormForCbo"
End Sub

Thanks!
 
J

Jeanette Cunningham

Monish,
instead of using cmdOK to open the query,>
While the form is running, open the query yourself from the database window
and see if there is any problem with opening the query.

Jeanette Cunningham
 
M

Monish

Jeanette

The interesting thing is that I created this database for a colleague and
she is having the issue on her end after I sent her the db. The version I
house on my end doesn't give me the error...does that make any sense?

So, I can open the query fine using the control on the form...

Thx
 
J

Jeanette Cunningham

Monish,
it makes it much harder to figure out what is going wrong.
One way to find out is to put some code in that form to try to track what is
going on.
Then send her a new database with the updated form in it.
You can for example put code in the form to write some results to a temp
table in her front end.
It would be much easier to visit your colleague and debug on her machine.

It is very unusual to open a query in code anyway. Perhaps if you explain
what the form is doing and how it is using the query we could suggest
another approach that is less error prone.

Jeanette Cunningham
 
M

Monish

Jeanette - thanks for responding firstly.

Unfortunately the other database is across the country or I might indeed
have stopped by in person.

This is a form in which the user executes a parameter query with a selection
from a drop down box, then clicking OK. It is meant to be able to run a
similar report for various Reps listed in the drop down...when she clicks ok
after making her selection she gets the Run Time Error 3075 message and if
she selects Debug it opens up the Script Editor and hghlights the line:

DoCmd.OpenQuery "QryRSNoSplitByRep", acViewNormal, acEdit

Is there perhaps some syntax that might be invalid for different versions of
Access? Again, this same code works fine for me using Access 2003; she may
have Access 2000. I can check that however.

I am not sure what you mean by putting extra code in the form...what event
should trigger that code?

Thanks again!
 
J

Jeanette Cunningham

Monish,
from your post it seems that you are using the drop down to choose a rep and
then run a report for that rep.
I suggest to avoid a parameter query and avoid opening the query altogether.

You can open a report from the combo directly, like this:
DoCmd.OpenReport "NameOfYourReport", , "[RepID] = " & Me.cboReps & "

The above will open the report for the RepID chosen in the drop down with
rep names.
If RepID is a text field, change it to
--> DoCmd.OpenReport "NameOfYourReport", , "[RepID] = """ & Me.cboReps &
""""

Replace NameOfYourReport, RepID and cboReps with your report, control and
field names.


Jeanette Cunningham
 

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

Top