p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Access and Access VBA > Access VBA
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 14th, 2007, 04:42 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ivanlaw Send a message via Yahoo to ivanlaw
Default Run-time error '3464':

The error is data type mismatch in criteria expression.
My is below:
DoCmd.OpenReport "rptMember", acViewPreview, , "ExpiryDate = " & txtDate.Value

My table got set an input mask for to become 99/99(month and year).Then the data type is text.Is it got anything wrong with my setting or coding?

Please help me...Thank you.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old December 14th, 2007, 11:00 AM
Friend of Wrox
Points: 3,645, Level: 25
Points: 3,645, Level: 25 Points: 3,645, Level: 25 Points: 3,645, Level: 25
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,114
Thanks: 2
Thanked 4 Times in 4 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Try

DoCmd.OpenReport "rptMember", acViewPreview, , "[ExpiryDate] = #" & Me.txtDate & "#"

You forgot the delimiters around the date.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old December 15th, 2007, 02:43 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ivanlaw Send a message via Yahoo to ivanlaw
Default

Hi there,
I have try your coding that you post to me,my program can run.But it still can not detect the data out from the database.May I know reason?From the table I can see the data is 06/03, so i type 06/03 in the text box(txtDate),but the report does not any related data from the table.

Thank you.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old December 17th, 2007, 11:54 AM
Friend of Wrox
Points: 9,516, Level: 42
Points: 9,516, Level: 42 Points: 9,516, Level: 42 Points: 9,516, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I would modify this slightly to do this instead:

Dim dtDate As Date
Dim sLink As String
Dim sDoc As String

sDoc = "rptMember"
dtDate = Me.txtDate
sLink = "[ExpiryDate] = #" & dtDate & "#"

DoCmd.OpenReport sDoc, acViewPreview, , sLink

That being said, it doesn't look like your input is a date. So this won't work becuase it is execting a date data type.

What you will need to do is:

Dim sDate As String
Dim sLink As String
Dim sDoc As String

sDoc = "rptMember"
dtDate = Me.txtDate
sLink = "[ExpiryDate] = '" & dtDate & "'"

DoCmd.OpenReport sDoc, acViewPreview, , sLink

Did that help?

mmcdonal

Look it up at: http://wrox.books24x7.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old December 17th, 2007, 11:55 AM
Friend of Wrox
Points: 9,516, Level: 42
Points: 9,516, Level: 42 Points: 9,516, Level: 42 Points: 9,516, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sorry, didn't preview the post.

What you will need to do is:

Dim sDate As String
Dim sLink As String
Dim sDoc As String

sDoc = "rptMember"
dtDate = Me.txtDate
sLink = "[ExpiryDate] = '" & sDate & "'"

DoCmd.OpenReport sDoc, acViewPreview, , sLink


mmcdonal

Look it up at: http://wrox.books24x7.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old December 19th, 2007, 04:47 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ivanlaw Send a message via Yahoo to ivanlaw
Default

Hi there,
I already try all you post to me, but it also can not show out the data from the table.Why?Should I provide you any information so that you can solve it for me?

Thank you.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old December 19th, 2007, 08:26 AM
Friend of Wrox
Points: 9,516, Level: 42
Points: 9,516, Level: 42 Points: 9,516, Level: 42 Points: 9,516, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If you can post the table information like field name and data type, and then the formatting of the text box, and then the pertinent query information from the report, we should be able to help.

The issue is that between the table data type, the variable and its data type, and the query and parameters it can take, the data type is not matching up somewhere. This is the most common cause of software issues: variable collisions.

mmcdonal

Look it up at: http://wrox.books24x7.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old December 28th, 2007, 04:49 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ivanlaw Send a message via Yahoo to ivanlaw
Default

From the table first,field name is ExpiryDate.Then its data type is a text and it got an input mask setting for an example, "06/03".
Then i just use the coding i already post to try and get somethings from the table named "Member".
I already try a lots of methods those i have learn and found out from the web site, but still can not.Now i really dun where is my mistake was.
Is that enough information for you to help me?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old December 28th, 2007, 09:02 AM
Friend of Wrox
Points: 9,516, Level: 42
Points: 9,516, Level: 42 Points: 9,516, Level: 42 Points: 9,516, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I would have to see the database and what you are doing. The code posted should work. Let me refresh:

The table name is "Member."
In that table you have a column called "ExpiryDate."
ExpiryDate is data type Text (number of characters? 50?)
ExpiryDate has an input mask of 99/99.
Please note, the input mask is requiring Numbers, not text.
How is the value stored when you enter it? For example, if the user enters 01/01, is it stored as 01/01, or as 1/1?

That being said, the code posted should work, but for a leading zeros issue.

Can you send the database with just the form and table and query?


mmcdonal

Look it up at: http://wrox.books24x7.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 12:17 PM
error 3464 'data type mismatch in criteria express Vince_421 Access VBA 3 May 3rd, 2007 07:45 AM
run-time error(s) Chacko C++ Programming 0 March 4th, 2007 02:28 PM
Run Time Error JBond Access VBA 0 May 27th, 2004 10:50 AM
RUN-TIME ERROR compcad Beginning VB 6 2 May 21st, 2004 03:01 AM



All times are GMT -4. The time now is 03:20 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc