Re: Mismatched Data Type in an Expression

From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 05/18/04


Date: Tue, 18 May 2004 12:07:04 -0400

Your WHERE clause is assuming that [Request_Counter] is text.

If it's Long Integer (as your post says), get rid of the quotes:

[Request_Counter] = " & V

(the semi-colon isn't necessary, by the way)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)
"Chris" <anonymous@discussions.microsoft.com> wrote in message
news:e7d501c43cdd$85062d30$a401280a@phx.gbl...
> Below is a sub I am using to compare two request counters
> so I can update the one table. I keep getting an error
> message on the SQL statement that says the data type is
> mismatched. All of the data types in the table are ong
> Integer as the length and the format as Fixed.
>
> I cannot seem to pinpoint what is wrong. Any help is
> appreciated.
>
> -Chris
>
>
>
> Private Sub Requested_Docs_Received_Click()
> Dim M As Recordset, D As Database, C As Recordset
> Set D = CurrentDb
>
> If [Requested_Docs_Received] = True Then
>    Me![Missing_Docs] = False
>    V = [Forms]![frmMain].[Request_Counter]
>    Set M = D.OpenRecordset("Select [Missing_Docs_Received]
> From [tblMissing] Where [Request_Counter] = '" & V & "';",
> dbOpenSnapshot)
>    M![Missing_Docs_Received] = True
>    M.Update
> End If


Relevant Pages

  • Re: access 2003
    ... Dim ctl As Control ... Dim rs As Recordset ... This sets the query definitions for choosing data to create an invoice using ... Event on combo box: Private Sub ChooseCust_AfterUpdate ...
    (microsoft.public.access.conversion)
  • RE: Dynamate report creation....help
    ... mode) in the query and it will construct the report for it. ... time with 26 columns and 200 rows in the recordset before I killed the print ... Dim RptRS As Recordset ... Private Sub Detail1_Format ...
    (microsoft.public.access.reports)
  • Re: Can Not Create Control
    ... > Private Sub Form_Load ... > Dim laco As Connection ... > Dim lars As Recordset ...
    (microsoft.public.pocketpc.developer)
  • Re: Auto complete drop down bookmark
    ... >> initialize statement of the userform will populate the combobox with data ... >> from the database. ... >> ' Retrieve the recordset ... >> Private Sub CommandButton1_Click ...
    (microsoft.public.word.vba.userforms)
  • Re: Scope of Db and Rst objects: General questions
    ... created by CurrentDb. ... object and know for sure that we are able to dereference it. ... > a Recordset object is opened like this: ... > Private Sub Example ...
    (microsoft.public.access.modulesdaovba)