473,395 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem now "data type mismatch in criteria expression"

thanks for replying
the problem now "data type mismatch in criteria expression"
May 15 '14 #1
10 1554
Seth Schrock
2,965 Expert 2GB
On which line do you get this error?
May 15 '14 #2
Set rst = mydb.OpenRecordset(tempst, dbOpenDynaset)
May 15 '14 #3
Seth Schrock
2,965 Expert 2GB
At the top of your code, right below the OPTION COMPARE DATABASE, enter OPTION EXPLICIT. Then, click on the Debug menu and select Compile (top option I think). This will hopefully spot some errors in the code that would be very difficult to otherwise find. Then, if you could post what you have now, it would be very helpful.
May 15 '14 #4
Seth Schrock
2,965 Expert 2GB
I'm not sure if there is a translation error or what, but most of what I'm seeing isn't english, so I have no idea how to fix the problem. I can link you to the MSDN website that deals with the DoCmd.SendObject command. If you have any questions about it, feel free to ask. DoCmd.SendObject Method
May 16 '14 #5
I changed it completely and now i have problem " data type mismatch in criteria expression " at
Set rest = mydb.OpenRecordset(temp, dbOpenDynaset)


Expand|Select|Wrap|Line Numbers
  1. Private Sub Command2_Click()
  2. Dim mydb As DAO.Database
  3. Dim rest As Recordset
  4. Dim temp As String
  5. Dim mpayroll As String
  6. Dim mpage As String
  7. Dim sqlstring As String
  8. Dim qdf As QueryDef
  9. Dim reset As Recordset
  10. Dim mmail As String
  11.  
  12.  
  13. Set mydb = CurrentDb
  14. temp = " SELECT DISTINCT payroll, page FROM pay WHERE page = '" & scode & "'" & " ORDER BY payroll"
  15. Set rest = mydb.OpenRecordset(temp, dbOpenDynaset)
  16. rest.MoveFirst
  17. While Not rest.EOF
  18.  
  19. mpayroll = rest("payroll")
  20. mpage = rest("page")
  21. sqlstring = " SELECT payed2.payroll, payed2.type, payed1.page, payed2.amount, personal.namee, personl.email" & _
  22.             " FROM payed2 INNER JOIN payed1 ON payed2.page = payed1.page, INNER JOIN personal ON payed2.payroll = personal.payroll" & _
  23.             " WHERE payed2.payroll =  '" & mpayroll & "' And payed2.Page = " & mpage & "" & _
  24.             " ORDER BY payed2.payroll "
  25.  
  26. qdf.SQL = sqlstring
  27. qdf.Close
  28.  
  29. Set reset = qdf.OpenRecordset
  30. reset.MoveFirst
  31. mmail = ("email")
  32. reset.Close
  33. DoCmd.SendObject acSendQuery, "pay", acFormatXLS, mmail, , , "here balance", " your balance here", False
  34. rest.MoveNext
  35. Wend
  36. MsgBox "EMAIL PROCESS COMPLETE", vbInformation
  37.  
  38. mydb.Close
  39.  
  40. End Sub
  41.  
May 18 '14 #6
Seth Schrock
2,965 Expert 2GB
On line 14, is "scode" a text data type?
May 19 '14 #7
zmbd
5,501 Expert Mod 4TB
POST#6
Line 3 Dim rest As Recordset
CHANGE TO
Line 3 Dim rest As DAO.Recordset
May 19 '14 #8
ok
scode is text box I searched in it about page " number" to limit set of records
May 19 '14 #9
Seth Schrock
2,965 Expert 2GB
Try making line 14 be
Expand|Select|Wrap|Line Numbers
  1. temp = " SELECT DISTINCT payroll, page FROM pay WHERE page = " & Me.scode & " ORDER BY payroll"
May 20 '14 #10
zmbd
5,501 Expert Mod 4TB
This thread was split from http://bytes.com/topic/access/answer...ery-individual

It appears that this thread was answered at Post#10

Another question was then asked in the following post, I have split this thread at that point.

Please do not post any further Q&A to this thread unless it is related to the first posting.
May 20 '14 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Didier ROS | last post by:
Hi, I am a newbie I want to create a temporary table and I get the following error message : mysql> CREATE TEMPORARY TABLE tempemp AS SELECT * FROM emp; ERROR 1044: Access denied for user:...
2
by: Thomas T. Thai | last post by:
I would like to select a random record from a group of records so I'd end up with one random record per group: CREATE TABLE randtest ( catnum int, title varchar(32) ); INSERT INTO randtest...
19
by: Woody Splawn | last post by:
I have a form who's height I would like to change in code. I would have supposed something like the following would work but it does not: Me.Size.Height = 292 I get "Expression is a value and...
4
by: Tony Lownds | last post by:
(Note: PEPs in the 3xxx number range are intended for Python 3000) PEP: 3107 Title: Function Annotations Version: $Revision: 53169 $ Last-Modified: $Date: 2006-12-27 20:59:16 -0800 (Wed, 27 Dec...
1
by: yashgt | last post by:
Hi, We have an application that has been deployed into a virtual folder along with ascx, aspx and the code-behind files. It runs smoothly as long as we don't change any code-behind file. If we...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
17
by: Klaas Vantournhout | last post by:
Hi all, I was wondering if it is possible if you can check in a function if one of the arguments is temporary. What I mean is the following. A is a class, foo is a function returning a class...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.