Solved

Dropdown List in Access for a Report

Posted on 2006-11-30
4
224 Views
Last Modified: 2013-11-28
Hello again,
     I'm sure this is an easy question, and I have already had one very simular to it answered.  Here is a link to the last question like this one I posted: http://www.experts-exchange.com/Databases/MS_Access/Q_22061922.html

This time the dropdown will be selecting a number instead of a string.  Thank you in advance for your help.  Here is the code I'm trying to use, but of course I am getting a data type mismatch error, so please help me change it:

Option Compare Database
Option Explicit
Dim strFilter As String

Private Sub cmdOpenReport_Click()
DoCmd.OpenReport "rpt_weekly_group", acViewPreview, , strFilter
End Sub

Private Sub Detail_Click()

End Sub

Private Sub GruopID_AfterUpdate()
strFilter = ""

    If Me.GruopID <> "" And Not IsNull(Me.GruopID) Then
        If strFilter = "" Then
            strFilter = "[GruopID]= " & Chr(34) & Me.GruopID & Chr(34) & ""
        Else
            strFilter = strFilter & " and [GruopID]= " & Chr(34) & Me.GruopID & Chr(34) & ""
        End If
    End If
End Sub
0
Comment
Question by:JBredensteiner
  • 2
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
jefftwilley earned 250 total points
Comment Utility
Private Sub GruopID_AfterUpdate()
strFilter = ""

    If NZ(Me.GruopID)<>"" Then
        If strFilter = "" Then
            strFilter = "[GruopID]= " & Me.GruopID
        Else
            strFilter = strFilter & " and " & [GruopID]= " & Me.GruopID
        End If
    End If
End Sub
0
 

Author Comment

by:JBredensteiner
Comment Utility
Your the best.  I love EE :)
0
 
LVL 34

Expert Comment

by:jefftwilley
Comment Utility
Anytime...hey, "Gruop"??? lol

oops
J
0
 

Author Comment

by:JBredensteiner
Comment Utility
I know, I just found that out the other day, when I kept getting errors, and after about an hour of banging my head against the keyboard I noticed "Gruop".  It is pretty much too late to change it now :)
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

743 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

13 Experts available now in Live!

Get 1:1 Help Now