Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

An expression you entered is the wrong data type for one of the arguments

Posted on 2006-07-17
4
Medium Priority
?
984 Views
Last Modified: 2010-08-05
I have created a form called frmContactCategoryFilter which lists ContactCategory in an unbound box
When the user selects a ContactCategory and clicks OK, frmContact is opened showing only records which have the same ContactCategoryID as the selection
The 'OK' button has the following code

    Dim DocName As String
    Dim LinkCriteria As String

    DocName = "frmContact"
    LinkCriteria = "[ContactCategoryID] = Forms![frmContactCategoryFilter]![lstContactCategory]"
    DoCmd.OpenForm DocName, , , LinkCriteria
           
And it works.
When frmContact opens, I would like frmContactCategoryFilter to close.

However, whenever I try to add a DoCmd.Close , frmContact opens showing the correct records,
the message "An expression you entered is the wrong data type for one of the arguments" is displayed
and frmContactCategoryFilter remains open.

What should I do?
0
Comment
Question by:Ludique
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 34

Assisted Solution

by:flavo
flavo earned 1000 total points
ID: 17127815
I can't see how it works in either case, this line:

    LinkCriteria = "[ContactCategoryID] = Forms![frmContactCategoryFilter]![lstContactCategory]"

Should read:

    LinkCriteria = "[ContactCategoryID] = " &  Forms![frmContactCategoryFilter]![lstContactCategory]

Dave
0
 
LVL 35

Accepted Solution

by:
Raynard7 earned 1000 total points
ID: 17127831
Try

docmd.Close acForm, Me
0
 

Author Comment

by:Ludique
ID: 17127840
I changed the line as shown
added     DoCmd.Close acForm, "frmContactCategoryFilter"
And it works.

Thanks Dave.

Steph.
0
 
LVL 34

Expert Comment

by:flavo
ID: 17128028
Not a problem, glad to help!

Dave
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question