[AccessD] Access 2007 - Type Mismatch

O'Connor, Patricia (OTDA) Patricia.O'Connor at otda.state.ny.us
Wed Aug 22 11:02:58 CDT 2007


I don't have access 2007 but did have problems with one of my record set
codes  and had to check the reference and then change the code that had
worked for 8 years. But mine was the .move portion

Make sure the DAO REFERENCE like 1st-3rd specially that it is higher
than an ADO reference

Try changing 
  dim strSQL as String
  Dim rst As DAO.Recordset 
  dim db as dao.database

  strSQL = "SELECT * FROM MyTable WHERE MyField = " & Chr(34) &
Me!MyField & Chr(34) 
  Set db = CurrentDb
  Set rst = db.OpenRecordset.OpenRecordset(strSQL)

 If Not (rst.EOF And rst.BOF) Then
      msgbox "This number has already been used.", etc.   
      Cancel = True
 End If


If db still doesn't work then change to 
   set rst = currentdb.openrecordset
Or 
   if (rst.eof = false) and (rst.bof = false)
Or  if not rst.eof and not rst.bof


**************************************************
* Patricia O'Connor
* Associate Computer Programmer Analyst
* OTDA - BDMA
* (W) mailto:Patricia.O'Connor at otda.state.ny.us
* (w) mailto:aa1160 at nysemail.state.ny.us
**************************************************
 

> 
--------------------------------------------------------
This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments.  Please notify the sender immediately by reply e-mail and delete the e-mail from your system. 


-----Original Message-----

> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gale Perez
> Sent: Friday, June 22, 2007 06:59 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Access 2007 - Type Mismatch
> 
> Thank you, Jim!  That was what I had originally, and it 
> worked just fine in Access 1997 and 2003, but I got the old 
> "Type Mismatch" error in 2007.  I remember now that even when 
> I commented out the rst bit and just ran the bit to capture 
> strSQL, I still got the error.
> 
> I just changed it all to use dlookup instead for this 
> purpose, but I'm getting a lot of "Type Mismatch" errors in 
> other parts of my forms where I wasn't before.  Back to the 
> drawing board!
> 
> Thank you all again for your help, and have a great weekend.
> Gale
>





More information about the AccessD mailing list