Solved

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

Posted on 2006-07-17
4
922 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
  • 2
4 Comments
 
LVL 34

Assisted Solution

by:flavo
flavo earned 250 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 250 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now