DAO 3.6 to 3.51 new error..

G

Guest

the following line used to work, but I had to change my reference to DAO. 3.5
because of replication in Access 97...

If DCount("*", "qryGlobalSearch") = 0 Then
MsgBox "Sorry, there were no results for '" & Me.txt_SearchDB & "'"
Else
DoCmd.OpenForm "frm_SearchResults"
End If


Now I get the following error:
Run-time error '64479'

The expression you entered as query parameter produced this error: 'The
object doesn't contain the Automation object 'Defect#.'

Are there any bandaid fixes for this while I wait to switch to Access 2000?
 
A

Allen Browne

DAO 3.51 is the correct version to use with Access 97 (JET 3.5), so that's
not the cause of the problem.

The error message indicates that something went wrong, but it's not clear
what. If qryGlobalSearch does contain a field named Defect#, make sure the
name has square brackets around it in the SQL statement, i.e. [Defect#]

If that's not the issue, try this sequence:

1. Compact the database to get rid of any temp stuff:
Tools | Database Utilities | Compact
Then repair:
Tools | Database Utilities | Repair

2. Close the database, and decompile. Enter something like this at the
command prompt while Access is not running. It is all one line, and include
the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

3. Compact again.

4. Open a code window, and choose References on the Tools menu. Remove any
references you are not actully using: ideally just Access 8, VBA, and DAO
3.51.

5. Choose Compile All on the Debug menu, to ensure all the code compiles.

If none of that works, an alternative would be to just open the search form,
and cancel its Open event if there are no records:
Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
Cancel = True
MsgBox "no results."
End If
End Sub

Post a followup if you're still stuck.
 
G

Guest

....I remember now. - There was a field named [Defect#] and I got rid of it.
I was thinking the word 'Defect' had to do with a "Defect" in my program -
totally forgot about that field.

Thanks!

Allen Browne said:
DAO 3.51 is the correct version to use with Access 97 (JET 3.5), so that's
not the cause of the problem.

The error message indicates that something went wrong, but it's not clear
what. If qryGlobalSearch does contain a field named Defect#, make sure the
name has square brackets around it in the SQL statement, i.e. [Defect#]

If that's not the issue, try this sequence:

1. Compact the database to get rid of any temp stuff:
Tools | Database Utilities | Compact
Then repair:
Tools | Database Utilities | Repair

2. Close the database, and decompile. Enter something like this at the
command prompt while Access is not running. It is all one line, and include
the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

3. Compact again.

4. Open a code window, and choose References on the Tools menu. Remove any
references you are not actully using: ideally just Access 8, VBA, and DAO
3.51.

5. Choose Compile All on the Debug menu, to ensure all the code compiles.

If none of that works, an alternative would be to just open the search form,
and cancel its Open event if there are no records:
Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
Cancel = True
MsgBox "no results."
End If
End Sub

Post a followup if you're still stuck.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

jonefer said:
the following line used to work, but I had to change my reference to DAO.
3.5
because of replication in Access 97...

If DCount("*", "qryGlobalSearch") = 0 Then
MsgBox "Sorry, there were no results for '" & Me.txt_SearchDB & "'"
Else
DoCmd.OpenForm "frm_SearchResults"
End If


Now I get the following error:
Run-time error '64479'

The expression you entered as query parameter produced this error: 'The
object doesn't contain the Automation object 'Defect#.'

Are there any bandaid fixes for this while I wait to switch to Access
2000?
 

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