Retrieving data from a table

I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.

My question:
I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.

Any help would be appreciated.
AB

Comments

  • : I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
    :
    : My question:
    : I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
    :
    : Any help would be appreciated.
    : AB
    :


    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138

    If you still have the error,can we see the query you are using and a bit of the code?
  • : : I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
    : :
    : : My question:
    : : I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
    : :
    : : Any help would be appreciated.
    : : AB
    : :
    :
    :
    : http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138
    :
    : If you still have the error,can we see the query you are using and a bit of the code?
    :
    Thanks and I made sure that the Letter was the last in the query, it is also the last in the join also.

    Here is a code example - should I read it into a certain kind of field or space?

    <%@ Language=VBScript %>


    <%
    Dim strConnection
    Dim Conn
    Dim RSobj
    Dim strSql
    Dim filePath


    filePath = Server.MapPath("information.mdb")
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & filePath
    Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
    "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
    "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
    "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
    "s.InterestChecked AND a.InterestChecked = 1")


    %>



    <%
    RSobj.Close
    Conn.close
    %>


    <%=RSobj("Prefix").Value%>
    <%=RSobj("r.FirstName").Value%>
    <%=RSobj("r.MiddleName").Value%>
    <%=RSobj("r.LastName").Value%>
    <%=RSobj("Suffix").Value%>
    <%=RSobj("r.Address").Value%>
    <%=RSobj("r.City").Value%>
    <%=Response.Write(", ")%>
    <%=RSobj("r.State").Value%>
    <%=RSobj("r.PostalCode").Value%>


    <%=RSobj("FullName").Value%>
    <%=RSobj("Title").Value%>
    <%=RSobj("Nickname").Value%>
    <%=RSobj("Organization").Value%>
    <%=RSobj("c.Address").Value%>
    <%=RSobj("c.City").Value%>
    <%=RSobj("c.State").Value%>
    <%=RSobj("c.PostalCode").Value%>


    <%=RSobj("Letter").Value%>
  • : : : I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
    : : :
    : : : My question:
    : : : I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
    : : :
    : : : Any help would be appreciated.
    : : : AB
    : : :
    : :
    : :
    : : http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138
    : :
    : : If you still have the error,can we see the query you are using and a bit of the code?
    : :
    : Thanks and I made sure that the Letter was the last in the query, it is also the last in the join also.
    :
    : Here is a code example - should I read it into a certain kind of field or space?
    :
    : <%@ Language=VBScript %>
    :
    :
    : <%
    : Dim strConnection
    : Dim Conn
    : Dim RSobj
    : Dim strSql
    : Dim filePath
    :
    :
    : filePath = Server.MapPath("information.mdb")
    : Set Conn = Server.CreateObject("ADODB.Connection")
    : Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & filePath
    : Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
    : "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
    : "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
    : "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
    : "s.InterestChecked AND a.InterestChecked = 1")
    :
    :
    : %>
    :
    :
    :
    :
    :
    : : : : : :
    : : : : :
    : : : :
    : : : :
    : :

    : <%
    : [red]RSobj.Close
    : Conn.close[/red]
    : %>
    :

    :

    :
    :
    : : :

    : <%=RSobj("Prefix").Value%>
    : <%=RSobj("r.FirstName").Value%>
    : <%=RSobj("r.MiddleName").Value%>
    : <%=RSobj("r.LastName").Value%>
    : <%=RSobj("Suffix").Value%>
    : <%=RSobj("r.Address").Value%>
    : <%=RSobj("r.City").Value%>
    : <%=Response.Write(", ")%>
    : <%=RSobj("r.State").Value%>
    : <%=RSobj("r.PostalCode").Value%>
    :
    :

    :

    :

    :
    :
    : : :
    <%=RSobj("FullName").Value%>
    : <%=RSobj("Title").Value%>
    : <%=RSobj("Nickname").Value%>
    : <%=RSobj("Organization").Value%>
    : <%=RSobj("c.Address").Value%>
    : <%=RSobj("c.City").Value%>
    : <%=RSobj("c.State").Value%>
    : <%=RSobj("c.PostalCode").Value%>
    :

    :

    :

    :
    :
    : : :
    <%=RSobj("Letter").Value%>
    :


    Why are you closing the recorset there ? remove those lines and lets take it from there.
  • : : : : I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
    : : : :
    : : : : My question:
    : : : : I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
    : : : :
    : : : : Any help would be appreciated.
    : : : : AB
    : : : :
    : : :
    : : :
    : : : http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138
    : : :
    : : : If you still have the error,can we see the query you are using and a bit of the code?
    : : :
    : : Thanks and I made sure that the Letter was the last in the query, it is also the last in the join also.
    : :
    : : Here is a code example - should I read it into a certain kind of field or space?
    : :
    : : <%@ Language=VBScript %>
    : :
    : :
    : : <%
    : : Dim strConnection
    : : Dim Conn
    : : Dim RSobj
    : : Dim strSql
    : : Dim filePath
    : :
    : :
    : : filePath = Server.MapPath("information.mdb")
    : : Set Conn = Server.CreateObject("ADODB.Connection")
    : : Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & filePath
    : : Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
    : : "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
    : : "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
    : : "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
    : : "s.InterestChecked AND a.InterestChecked = 1")
    : :
    : :
    : : %>
    : :
    : :
    : :
    : :
    : :
    : : : : : : : : : : : :
    : : : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : :

    : : <%
    : : [red]RSobj.Close
    : : Conn.close[/red]
    : : %>
    : :

    : :

    : :
    : :
    : : : : : :

    : : <%=RSobj("Prefix").Value%>
    : : <%=RSobj("r.FirstName").Value%>
    : : <%=RSobj("r.MiddleName").Value%>
    : : <%=RSobj("r.LastName").Value%>
    : : <%=RSobj("Suffix").Value%>
    : : <%=RSobj("r.Address").Value%>
    : : <%=RSobj("r.City").Value%>
    : : <%=Response.Write(", ")%>
    : : <%=RSobj("r.State").Value%>
    : : <%=RSobj("r.PostalCode").Value%>
    : :
    : :

    : :

    : :

    : :
    : :
    : : : : : :
    <%=RSobj("FullName").Value%>
    : : <%=RSobj("Title").Value%>
    : : <%=RSobj("Nickname").Value%>
    : : <%=RSobj("Organization").Value%>
    : : <%=RSobj("c.Address").Value%>
    : : <%=RSobj("c.City").Value%>
    : : <%=RSobj("c.State").Value%>
    : : <%=RSobj("c.PostalCode").Value%>
    : :

    : :

    : :

    : :
    : :
    : : : : : :
    <%=RSobj("Letter").Value%>
    : :
    :
    :
    : Why are you closing the recorset there ? remove those lines and lets take it from there.
    :
    Sorry, that's me changing things up. Done and same error.
  • pls show us the exact error message and thelline where it occurs.
  • : pls show us the exact error message and thelline where it occurs.
    :
    Error Type:
    Microsoft JET Database Engine (0x80004005)
    Type mismatch in expression.
    /SeniorP/Stage2/advLetter2.asp, line 15

    and it occurs here:
    Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
    "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
    "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
    "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
    "s.InterestChecked AND a.InterestChecked = 1")

  • : : pls show us the exact error message and thelline where it occurs.
    : :
    : Error Type:
    : Microsoft JET Database Engine (0x80004005)
    : Type mismatch in expression.
    : /SeniorP/Stage2/advLetter2.asp, line 15
    :
    : and it occurs here:
    : Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
    : "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
    : "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
    : "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
    : "s.InterestChecked AND a.InterestChecked = 1")
    :
    :

    What's the datatype of a.InterestChecked?is it a number?If not,pad it with quotes

    [code]
    Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
    "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
    "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
    "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
    "s.InterestChecked AND a.InterestChecked =[red] '1'[/red]")

    [/code]

    Also,all the interestChecked fields should be of the same datatype.

    Other than that,can't see anything wrong with your query.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories