Advertisement

05.29.2008 at 12:46PM PDT, ID: 23442722
[x]
Attachment Details

Setting as Default = "all"  on Add "All" to Combo # Name error or does not return to Null on Click of Option

Asked by kfschaefer1 in Access Coding/Macros, Access Forms

Tags: MS, Access, 2003

I have a mainform/subform with a combo and option fields on Main.  I am using the standard query (SEE '>>>>>) that includes "All" as part of the Union query.  The problem arises when the User selects Show All in the option frame and I try to reset the value of the combo back to "ALL" - I get #Name error.  What am I missing.

KStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
Option Compare Database
 
 
Private Sub cmbSearchbyName_AfterUpdate()
    gTP = Me.cmbSearchbyName.Value
    Select Case gTP
        Case "All"
            strSQL = "Select * from qryEmergentWk where Tech_grp_person "
        Case Else
            strSQL = "Select * from qryEmergentWk where Tech_grp_person = " & Chr(39) & gTP & Chr(39) & ""
    End Select
        Forms![frmEmergentWkFilter]![sub1].Form.RecordSource = strSQL
End Sub
 
Private Sub cmdClose_Click()
    DoCmd.OpenForm "Switchboard", acNormal, , , acFormEdit, acDialog
End Sub
 
Private Sub Form_Current()
    Me.cmbSearchbyName.RowSource = _
        "SELECT A.Name FROM (Select 'All' as Name From Personnel Union SELECT Name FROM Personnel) AS A ORDER BY A.Name"
    Me.cmbSearchbyName.DefaultValue = "All"
 
End Sub
 
Private Sub Form_Open(Cancel As Integer)
    For Each frm In Forms
        If frm.Name <> Me.Name Then DoCmd.Close acForm, frm.Name
    Next frm
End Sub
 
Private Sub frmOption_AfterUpdate()
    gTP = Me.cmbSearchbyName.Value
    Select Case frmOption
       Case 1
            Select Case gTP
                Case "All"
                    strSQL = "Select * from qryEmergentWk where Tech_grp_person"
                Case Else
                    strSQL = "Select * from qryEmergentWk where Tech_grp_person = " & Chr(39) & gTP & Chr(39) & ""
            End Select
        Case 2
            Select Case gTP
                Case "All"
                    strSQL = "Select * from qryEmergentWk where Tech_grp_person and Status <> 'Completed'"
                Case Else
                    strSQL = "Select * from qryEmergentWk where Tech_grp_person = " & Chr(39) & gTP & Chr(39) & " and Status <> 'Completed'"
            End Select
            Forms![frmEmergentWkFilter]![sub1].Form.RecordSource = strSQL
   End Select
 
End Sub
Attachments:
 
scrren shots of problem
 
[+][-]05.29.2008 at 01:29PM PDT, ID: 21673024

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 01:30PM PDT, ID: 21673033

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 02:08PM PDT, ID: 21673284

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Access Forms
Tags: MS, Access, 2003
Sign Up Now!
Solution Provided By: jimhorn
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.29.2008 at 02:31PM PDT, ID: 21673468

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 03:13PM PDT, ID: 21673781

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628