Checking for Null & Select Case

I have a form called fSearchforCompany with two unbound fields.  After
selecting a field from lstQuickSearch (list box) and tabbing to txtSearchBox
to enter data, the correct form should open with the text from txtSearchBox
entered into the designated field.  But, first the code should check for null,
and if Null, open the correct form.

The problems are the code is not doing anything on Null and when there is
data it is not selecting the data.

The two fields are:

     1.  lstQuickSearch
         ControlSource is empty
         Row Source = 1;"Company ID";2;"Company Name";3;"Date of
Event";4;"Event Type"
         Row Type = Value List

     2.  txtSearchBox
         Control Source is empty
         After Update Event code is listed below:


     Private Sub txtSearchBox_AfterUpdate()

     On Error GoTo ErrorHandler     

        Select Case Me.lstQuickSearch.Value

            Case 1:
                 If IsNull(txtSearchBox) Then
                     DoCmd.OpenForm ("[frmListforCompanyID")
                     DoCmd.GoToControl ("cboSearchBox")
                 Else
                     DoCmd.OpenForm ("frmListforCompanyID")
                     DoCmd.GoToControl ("cboSearchBox")
                     Forms!frmListforCompanyID!cboSearchBox.ControlSource =
txtSearchBox
                 End If
            Case 2:
                 If IsNull(txtSearchBox) Then
                     DoCmd.OpenForm ("frmListforCompanyName")
                     DoCmd.GoToControl ("cboSearchBox")
                 Else
                     DoCmd.OpenForm ("frmListforCompanyName")
                     DoCmd.GoToControl ("cboSearchBox")
                     Forms!frmListforCompanyName!cboSearchBox.ControlSource =
txtSearchBox
                 End If
            Case 2:
                 If IsNull(txtSearchBox) Then
                     DoCmd.OpenForm ("fdlgEventDetail")
                     DoCmd.GoToControl ("txtEventDate")
                 Else
                     DoCmd.OpenForm ("fdlgEventDetail")
                     DoCmd.GoToControl ("txtEventDate")
                     Forms!fdlgEventDetail!txtEventDate.ControlSource =
txtSearchBox
                 End If
            Case Else
                MsgBox "Invalid selection", vbExclamation
                Exit Sub
         End Select

     CleanUpAndExit:
         Exit Sub

     ErrorHandler:
         Call MsgBox("An error was encountered" & vbCrLf & vbCrLf & _
             "Description:  " & Err.Description & vbCrLf & _
             "Error Number:  " & Err.Number, , "Error")
         Resume CleanUpAndExit

     End Sub

Thanks for any help!

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/4/2010 8:54:19 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

14 Replies
1012 Views

Similar Articles

[PageSpeed] 10

The problem is with this line:
Forms!frmListforCompanyID!cboSearchBox.ControlSource =
txtSearchBox


The ControlSource property is used to tell access what field in the table to 
save the data in.

Instead just set the value for the combo like this:
Forms!frmListforCompanyID!cboSearchBox = txtSearchBox

Whatever is the value for txtSearchBox needs to be in the Row Source of 
cboSearchBox.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"lmcc via AccessMonster.com" <u59647@uwe> wrote in message 
news:a90a24f642615@uwe...
>I have a form called fSearchforCompany with two unbound fields.  After
> selecting a field from lstQuickSearch (list box) and tabbing to 
> txtSearchBox
> to enter data, the correct form should open with the text from 
> txtSearchBox
> entered into the designated field.  But, first the code should check for 
> null,
> and if Null, open the correct form.
>
> The problems are the code is not doing anything on Null and when there is
> data it is not selecting the data.
>
> The two fields are:
>
>     1.  lstQuickSearch
>         ControlSource is empty
>         Row Source = 1;"Company ID";2;"Company Name";3;"Date of
> Event";4;"Event Type"
>         Row Type = Value List
>
>     2.  txtSearchBox
>         Control Source is empty
>         After Update Event code is listed below:
>
>
>     Private Sub txtSearchBox_AfterUpdate()
>
>     On Error GoTo ErrorHandler
>
>        Select Case Me.lstQuickSearch.Value
>
>            Case 1:
>                 If IsNull(txtSearchBox) Then
>                     DoCmd.OpenForm ("[frmListforCompanyID")
>                     DoCmd.GoToControl ("cboSearchBox")
>                 Else
>                     DoCmd.OpenForm ("frmListforCompanyID")
>                     DoCmd.GoToControl ("cboSearchBox")
>                     Forms!frmListforCompanyID!cboSearchBox.ControlSource =
> txtSearchBox
>                 End If
>            Case 2:
>                 If IsNull(txtSearchBox) Then
>                     DoCmd.OpenForm ("frmListforCompanyName")
>                     DoCmd.GoToControl ("cboSearchBox")
>                 Else
>                     DoCmd.OpenForm ("frmListforCompanyName")
>                     DoCmd.GoToControl ("cboSearchBox")
>                     Forms!frmListforCompanyName!cboSearchBox.ControlSource 
> =
> txtSearchBox
>                 End If
>            Case 2:
>                 If IsNull(txtSearchBox) Then
>                     DoCmd.OpenForm ("fdlgEventDetail")
>                     DoCmd.GoToControl ("txtEventDate")
>                 Else
>                     DoCmd.OpenForm ("fdlgEventDetail")
>                     DoCmd.GoToControl ("txtEventDate")
>                     Forms!fdlgEventDetail!txtEventDate.ControlSource =
> txtSearchBox
>                 End If
>            Case Else
>                MsgBox "Invalid selection", vbExclamation
>                Exit Sub
>         End Select
>
>     CleanUpAndExit:
>         Exit Sub
>
>     ErrorHandler:
>         Call MsgBox("An error was encountered" & vbCrLf & vbCrLf & _
>             "Description:  " & Err.Description & vbCrLf & _
>             "Error Number:  " & Err.Number, , "Error")
>         Resume CleanUpAndExit
>
>     End Sub
>
> Thanks for any help!
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1
> 


0
Jeanette
6/4/2010 10:35:15 PM
Thanks Jeanette,

After it select the text and go to the form and cboSearchBox control, the
cobSearchBox After Update Event does not work.  I have to remove the text and
reenter it and then it searches.

Also, the Null is not working.  I had to enter a space and then it opened the
form and so on.

Your thoughts on what's causing it?

Jeanette Cunningham wrote:
>The problem is with this line:
>Forms!frmListforCompanyID!cboSearchBox.ControlSource =
>txtSearchBox
>
>The ControlSource property is used to tell access what field in the table to 
>save the data in.
>
>Instead just set the value for the combo like this:
>Forms!frmListforCompanyID!cboSearchBox = txtSearchBox
>
>Whatever is the value for txtSearchBox needs to be in the Row Source of 
>cboSearchBox.
>
>Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>
>>I have a form called fSearchforCompany with two unbound fields.  After
>> selecting a field from lstQuickSearch (list box) and tabbing to 
>[quoted text clipped - 74 lines]
>>
>> Thanks for any help!

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/4/2010 10:53:25 PM
The after update won't work because you used code to select the value for
cboSearchBox.
You can use code to make the after update event fire.

On the load event you can go:
Call cboSearchBox_AfterUpdate


Null not working, debug it like this

Debug.Print Me.txtSearchBox
If IsNull(Me.txtSearchBox) Then
                     DoCmd.OpenForm ("[frmListforCompanyID")
                     DoCmd.GoToControl ("cboSearchBox")
                 Else
                     DoCmd.OpenForm ("frmListforCompanyID")
                     DoCmd.GoToControl ("cboSearchBox")
                     Forms!frmListforCompanyID!cboSearchBox.ControlSource =
txtSearchBox
End If

Run the code with the form in normal view, then open the immediate window to 
see what value access gets for Me.txtSearchBox.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia




"lmcc via AccessMonster.com" <u59647@uwe> wrote in message
news:a90b2f2007c05@uwe...
> Thanks Jeanette,
>
> After it select the text and go to the form and cboSearchBox control, the
> cobSearchBox After Update Event does not work.  I have to remove the text
> and
> reenter it and then it searches.
>
> Also, the Null is not working.  I had to enter a space and then it opened
> the
> form and so on.
>
> Your thoughts on what's causing it?
>
> Jeanette Cunningham wrote:
>>The problem is with this line:
>>Forms!frmListforCompanyID!cboSearchBox.ControlSource =
>>txtSearchBox
>>
>>The ControlSource property is used to tell access what field in the table
>>to
>>save the data in.
>>
>>Instead just set the value for the combo like this:
>>Forms!frmListforCompanyID!cboSearchBox = txtSearchBox
>>
>>Whatever is the value for txtSearchBox needs to be in the Row Source of
>>cboSearchBox.
>>
>>Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>>
>>>I have a form called fSearchforCompany with two unbound fields.  After
>>> selecting a field from lstQuickSearch (list box) and tabbing to
>>[quoted text clipped - 74 lines]
>>>
>>> Thanks for any help!
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1
>



0
Jeanette
6/5/2010 3:51:48 AM
I changed the code to:

  Select Case Me.lstQuickSearch.Value   
       Case 1:
            If Trim([txtSearchBox] & " ") = "" Then
                DoCmd.OpenForm ("[frmListforCompanyID")
                DoCmd.GoToControl ("cboSearchBox")
            Else
                DoCmd.OpenForm ("frmListforCompanyID")
                DoCmd.GoToControl ("cboSearchBox")
                Forms!frmListforCompanyID!cboSearchBox = txtSearchBox
            End If
       Case 2:
            If Trim([txtSearchBox] & " ") = "" Then
                DoCmd.OpenForm ("frmListforCompanyName")
                DoCmd.GoToControl ("cboSearchBox")
            Else
                DoCmd.OpenForm ("frmListforCompanyName")
                DoCmd.GoToControl ("cboSearchBox")
                Forms!frmListforCompanyName!cboSearchBox = txtSearchBox
            End If
       Case 3:
            If Trim([txtSearchBox] & " ") = "" Then
                DoCmd.OpenForm ("fdlgEventDetail")
                DoCmd.GoToControl ("txtEventDate")
            Else
                DoCmd.OpenForm ("fdlgEventDetail")
                DoCmd.GoToControl ("txtEventDate")
                Forms!fdlgEventDetail!txtEventDate = txtSearchBox
            End If
       Case Else
           MsgBox "Invalid selection", vbExclamation
           Exit Sub
    End Select

Now the Null situation is taken care of.

The only problem is the selected text in txtSearchBox when put into
cboSearchBox won't search on the data; I have to delete it and type it back
in and then the search works.  That's what I was trying to use the Else
statement for, so I would not have to retype the entry.

Jeanette Cunningham wrote:
>The after update won't work because you used code to select the value for
>cboSearchBox.
>You can use code to make the after update event fire.
>
>On the load event you can go:
>Call cboSearchBox_AfterUpdate
>
>Null not working, debug it like this
>
>Debug.Print Me.txtSearchBox
>If IsNull(Me.txtSearchBox) Then
>                     DoCmd.OpenForm ("[frmListforCompanyID")
>                     DoCmd.GoToControl ("cboSearchBox")
>                 Else
>                     DoCmd.OpenForm ("frmListforCompanyID")
>                     DoCmd.GoToControl ("cboSearchBox")
>                     Forms!frmListforCompanyID!cboSearchBox.ControlSource =
>txtSearchBox
>End If
>
>Run the code with the form in normal view, then open the immediate window to 
>see what value access gets for Me.txtSearchBox.
>
>Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>
>> Thanks Jeanette,
>>
>[quoted text clipped - 30 lines]
>>>>
>>>> Thanks for any help!

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/5/2010 4:30:41 AM
Would you post the code that you have for the after update event for 
cboSearchBox.
Did you put this code on the load event for frmListForCompanyID?


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"lmcc via AccessMonster.com" <u59647@uwe> wrote in message 
news:a90e20cfe3c18@uwe...
>I changed the code to:
>
>  Select Case Me.lstQuickSearch.Value
>       Case 1:
>            If Trim([txtSearchBox] & " ") = "" Then
>                DoCmd.OpenForm ("[frmListforCompanyID")
>                DoCmd.GoToControl ("cboSearchBox")
>            Else
>                DoCmd.OpenForm ("frmListforCompanyID")
>                DoCmd.GoToControl ("cboSearchBox")
>                Forms!frmListforCompanyID!cboSearchBox = txtSearchBox
>            End If
>       Case 2:
>            If Trim([txtSearchBox] & " ") = "" Then
>                DoCmd.OpenForm ("frmListforCompanyName")
>                DoCmd.GoToControl ("cboSearchBox")
>            Else
>                DoCmd.OpenForm ("frmListforCompanyName")
>                DoCmd.GoToControl ("cboSearchBox")
>                Forms!frmListforCompanyName!cboSearchBox = txtSearchBox
>            End If
>       Case 3:
>            If Trim([txtSearchBox] & " ") = "" Then
>                DoCmd.OpenForm ("fdlgEventDetail")
>                DoCmd.GoToControl ("txtEventDate")
>            Else
>                DoCmd.OpenForm ("fdlgEventDetail")
>                DoCmd.GoToControl ("txtEventDate")
>                Forms!fdlgEventDetail!txtEventDate = txtSearchBox
>            End If
>       Case Else
>           MsgBox "Invalid selection", vbExclamation
>           Exit Sub
>    End Select
>
> Now the Null situation is taken care of.
>
> The only problem is the selected text in txtSearchBox when put into
> cboSearchBox won't search on the data; I have to delete it and type it 
> back
> in and then the search works.  That's what I was trying to use the Else
> statement for, so I would not have to retype the entry.
>
> Jeanette Cunningham wrote:
>>The after update won't work because you used code to select the value for
>>cboSearchBox.
>>You can use code to make the after update event fire.
>>
>>On the load event you can go:
>>Call cboSearchBox_AfterUpdate
>>
>>Null not working, debug it like this
>>
>>Debug.Print Me.txtSearchBox
>>If IsNull(Me.txtSearchBox) Then
>>                     DoCmd.OpenForm ("[frmListforCompanyID")
>>                     DoCmd.GoToControl ("cboSearchBox")
>>                 Else
>>                     DoCmd.OpenForm ("frmListforCompanyID")
>>                     DoCmd.GoToControl ("cboSearchBox")
>>                     Forms!frmListforCompanyID!cboSearchBox.ControlSource 
>> =
>>txtSearchBox
>>End If
>>
>>Run the code with the form in normal view, then open the immediate window 
>>to
>>see what value access gets for Me.txtSearchBox.
>>
>>Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>>
>>> Thanks Jeanette,
>>>
>>[quoted text clipped - 30 lines]
>>>>>
>>>>> Thanks for any help!
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1
> 


0
Jeanette
6/5/2010 8:49:49 PM
Okay Jeanette,

Here’s the code:

     Private Sub cboSearchBox_AfterUpdate()

     On Error GoTo ErrorHandler

         Me.txtCompanyName.Enabled = True
         Me.txtCompanyName.SetFocus
    
         If Not IsNull(cboSearchBox) Then
             DoCmd.FindRecord cboSearchBox
             Me.txtBlank.SetFocus
             Me.txtCompanyName.Enabled = False
             Me.cboSearchBox.Value = Null
        
         End If


     CleanUpAndExit:
         Exit Sub

     ErrorHandler:
         Call MsgBox("An error was encountered" & vbCrLf & vbCrLf & _
             "Description:  " & Err.Description & vbCrLf & _
             "Error Number:  " & Err.Number, , "Error")
         Resume CleanUpAndExit

     End Sub


No, I didn’t put code on the load event for frmListForCompanyID.

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/5/2010 10:39:14 PM
You need to make the after update event using code after the form opens.
So on the form's load event, below any other code you have on the load event 
put this line of code:

Call cboSearchBox_AfterUpdate



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"lmcc via AccessMonster.com" <u59647@uwe> wrote in message 
news:a917a20a61257@uwe...
> Okay Jeanette,
>
> Here's the code:
>
>     Private Sub cboSearchBox_AfterUpdate()
>
>     On Error GoTo ErrorHandler
>
>         Me.txtCompanyName.Enabled = True
>         Me.txtCompanyName.SetFocus
>
>         If Not IsNull(cboSearchBox) Then
>             DoCmd.FindRecord cboSearchBox
>             Me.txtBlank.SetFocus
>             Me.txtCompanyName.Enabled = False
>             Me.cboSearchBox.Value = Null
>
>         End If
>
>
>     CleanUpAndExit:
>         Exit Sub
>
>     ErrorHandler:
>         Call MsgBox("An error was encountered" & vbCrLf & vbCrLf & _
>             "Description:  " & Err.Description & vbCrLf & _
>             "Error Number:  " & Err.Number, , "Error")
>         Resume CleanUpAndExit
>
>     End Sub
>
>
> No, I didn't put code on the load event for frmListForCompanyID.
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1
> 


0
Jeanette
6/5/2010 10:58:08 PM
Jeanette,

I entered the "Call cboSearchBox_AfterUpdate" but still get the same results.

I am going to leave it for now while I rethink it and read more about
filtering because this should be pretty simple.  

Sometimes it helps when you stop and restart over.  Because what I am trying
to say is search for this data; if found, open this detail form filtered on
the searched data.  If null, open this list form without any filters.

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/6/2010 12:30:06 AM
oops I hit Post to soon.

Thanks for your help!

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/6/2010 12:30:56 AM
Hello again Jeanette,

Okay, here I go, I started over.  

1.  The lstSelectionBox will have 9 values to choose from.
2.  The txtSearchBox is where I enter the data (criteria).
3.  If txtSearchBox is empty or the data is not found, then open
frmSearchCompanyID.
4.  If there is data in txtSearchBox, then open the fmainCompany and filter
on the CompanyID in 
     txtSearchBox.

Below is what I have so far:

     Private Sub txtSearchBox_AfterUpdate()
         Select Case Me.lstSelectionBox.Value
             Case 1:
                 If Trim([txtSearchBox] & " ") = "" Then
                     DoCmd.OpenForm ("frmSearchCompanyID")
                     DoCmd.GoToControl ("cboSearchBox")
                 Else
                     DoCmd.OpenForm ("fmainCompany")
                     Me.Filter = "CompanyID = " & Me.txtSearchBox
                     Me.FilterOn = True
                 End If            
             End Select
     End Sub

Problems:
1.  How to handle when the data entered into txtSearchBox is not found.
2.  Filter is not working when it opens fmainCompany form.

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/6/2010 5:08:42 AM
You can pass the filter to fmainCompany using OpenArgs and then use it
to filter the form.

---------------------
Dim strFilter As String

strFilter =  "CompanyID = " & Me.txtSearchBox
DoCmd.OpenForm ("fmainCompany"), , , , , , strFilter
----------------
In the load event for fmainCompany go:

Private Sub Form_Load
If Not IsNull(Me.OpenArgs) Then
    Me.Filter = Me.OpenArgs
    Me.FilterOn = True
End If
End Sub

You can also use a filter in the after update of cboSearchBox if you wish.

 If Not IsNull(cboSearchBox) Then
             Me.Filter =  "CompanyID = " & Me.cboSearchBox
             Me.FilterOn = True
             Me.txtBlank.SetFocus
             Me.txtCompanyName.Enabled = False
 End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"lmcc via AccessMonster.com" <u59647@uwe> wrote in message
news:a91b08bd0d63f@uwe...
> Hello again Jeanette,
>
> Okay, here I go, I started over.
>
> 1.  The lstSelectionBox will have 9 values to choose from.
> 2.  The txtSearchBox is where I enter the data (criteria).
> 3.  If txtSearchBox is empty or the data is not found, then open
> frmSearchCompanyID.
> 4.  If there is data in txtSearchBox, then open the fmainCompany and
> filter
> on the CompanyID in
>     txtSearchBox.
>
> Below is what I have so far:
>
>     Private Sub txtSearchBox_AfterUpdate()
>         Select Case Me.lstSelectionBox.Value
>             Case 1:
>                 If Trim([txtSearchBox] & " ") = "" Then
>                     DoCmd.OpenForm ("frmSearchCompanyID")
>                     DoCmd.GoToControl ("cboSearchBox")
>                 Else
>                     DoCmd.OpenForm ("fmainCompany")
>                     Me.Filter = "CompanyID = " & Me.txtSearchBox
>                     Me.FilterOn = True
>                 End If
>             End Select
>     End Sub
>
> Problems:
> 1.  How to handle when the data entered into txtSearchBox is not found.
> 2.  Filter is not working when it opens fmainCompany form.
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1
>



0
Jeanette
6/6/2010 7:15:19 AM
I'm confused.  Are you saying to use the code instead of the Select Case code?


Where does "Dim strFilter As String, strFilter =  "CompanyID = " & Me.
txtSearchBox, DoCmd.OpenForm ("fmainCompany"), , , , , , strFilter" code go?


Jeanette Cunningham wrote:
>You can pass the filter to fmainCompany using OpenArgs and then use it
>to filter the form.

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/6/2010 5:33:27 PM
In the code below is where it goes.

Private Sub txtSearchBox_AfterUpdate()
    Dim strFilter As String
         Select Case Me.lstSelectionBox.Value
             Case 1:
                 If Trim([txtSearchBox] & " ") = "" Then
                     DoCmd.OpenForm ("frmSearchCompanyID")
                     DoCmd.GoToControl ("cboSearchBox")
                 Else
                     DoCmd.OpenForm ("fmainCompany")
                     strFilter =  "CompanyID = " & Me.txtSearchBox
                     DoCmd.OpenForm ("fmainCompany"), , , , , , strFilter
                 End If
             End Select
     End Sub

Then when fmainComapy opens, its load event will put the value of CompanyID 
in the combo and call the code that makes the after update event of the code 
run.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"lmcc via AccessMonster.com" <u59647@uwe> wrote in message 
news:a9218917e2715@uwe...
> I'm confused.  Are you saying to use the code instead of the Select Case 
> code?
>
>
> Where does "Dim strFilter As String, strFilter =  "CompanyID = " & Me.
> txtSearchBox, DoCmd.OpenForm ("fmainCompany"), , , , , , strFilter" code 
> go?
>
>
> Jeanette Cunningham wrote:
>>You can pass the filter to fmainCompany using OpenArgs and then use it
>>to filter the form.
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1
> 


0
Jeanette
6/7/2010 2:21:13 AM
Okay!  Thank you!


Jeanette Cunningham wrote:
>In the code below is where it goes.
>
>Private Sub txtSearchBox_AfterUpdate()
>    Dim strFilter As String
>         Select Case Me.lstSelectionBox.Value
>             Case 1:
>                 If Trim([txtSearchBox] & " ") = "" Then
>                     DoCmd.OpenForm ("frmSearchCompanyID")
>                     DoCmd.GoToControl ("cboSearchBox")
>                 Else
>                     DoCmd.OpenForm ("fmainCompany")
>                     strFilter =  "CompanyID = " & Me.txtSearchBox
>                     DoCmd.OpenForm ("fmainCompany"), , , , , , strFilter
>                 End If
>             End Select
>     End Sub
>
>Then when fmainComapy opens, its load event will put the value of CompanyID 
>in the combo and call the code that makes the after update event of the code 
>run.
>
>Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>
>> I'm confused.  Are you saying to use the code instead of the Select Case 
>> code?
>[quoted text clipped - 5 lines]
>>>You can pass the filter to fmainCompany using OpenArgs and then use it
>>>to filter the form.

-- 
Message posted via http://www.accessmonster.com

0
lmcc
6/7/2010 4:41:38 AM
Reply:

Similar Artilces:

merge MSN Bill Pay & Checking Acct
I want to merge my checking account with MSN Bill Pay but only see that I can merge MSN Bill Pay with my checking account (i.e., you lose all of your checking account information). Does any one have any suggestions? -- cheers, Tom G ...

Check names not working for multiple address books / contacts
Hello! I have upgraded from outlook 2003 to outlook 2007, my contacts are stored in pst. I used to be able to search for a name via check names and it displayed me all the results from global address list and from my contacts, but now it only does one. It does not matter which one I set in the checking order, whichever is top will be the one that provides the result. I would like it to show me both results, how would I go about to set that up? Thank you Deana More accurate and complete information would be helpful. The Global Address List is only available to those who c...

Authorizing checks with RMS
I recently removed PCCharge and setup my syetm to work with a preferred merchant provider to allow native processing of credit & debit cards. Since check verification/authorization was handled by PCCharge to Telecheck, check authorization is now not being done. How is check authorization accomplished using a preferred provider? Thanks, Richard Unfortunately, it's not. PC Charge is the only option for check processing in RMS as far as I know. TPI or some other vendor may support it through an add-in, but RMS as shipped has no way of doing both checks and debit... -- -- Gle...

Change management
Thanks in advance. Some co-workers use a third party analysis tool built upon a complex, proprietary 2005 db. To assist their efforts to validate their inputs to this tool, I long ago created a some views in another db on the same server. The views join some 18 or more tables from the proprietary db. All the joined table names are fully qualified with the prefix 'dbname.dbo.' Also created were functions and sprocs that also reference the proprietary db. These views, sprocs, & functions are used by both an Excel application and by a DotNet app, i.e., they'r...

How do I create Check list
1.I am new to excel and want to create a simple check list. I would like to have the first column check boxes and then the following columns discription and notes. Can someone give me a step by step on how to do this. I have created spread sheets but am not familiar with check boxes. 2.Also, Can someone tell me the difference between Access and Excel? Geek 1) Not sure what you're aiming to do with the checkboxes, but if you right click on the toolbar area, you will get a list of available toolbars. You want either the 'forms' toolbox or the 'controls' toolbox. Genera...

Preventing multiple check boxes from being checked
I have a worksheet with over 20 rows of check boxes with 5 check boxes in each row. (from the forms toolbox) I would like to prevent the user from checking more than one box in each row. Is this possible? BTW, this forum has been a great help. I'm so glad that expert Excel users are so willing to share their wealth of knowledge. Thanks again. Jae Put them in a group box, again from the forms toolbar. Drag the group box onto the sheet, then drag the checkboxes in. -- HTH RP (remove nothere from the email address if mailing direct) "Jae" <Jae@discussions.micro...

Check text field value against underlying table or query of combo box
Hello, I have a form on which the user can enter new records or update existing ones. If the user enters a new record on the form, I would like to have an 'After Update' event on one of the text fields, which is the item# to check if the value entered already exists in the underlying table, tbl_item. How can I call the table from the 'After Update' event of the text field and check for that value in the table? Thanks in advance. Regards, A. Crawford antcraw@swbell.net wrote: >I have a form on which the user can enter new records or update >existing ones. >If the us...

Printing Checks
I'm having a problem printing checks from Money 2003. I have three accounts that come up in one .mny file. Two of the accounts use 3-on-a-page checks and I want the name and address printed on them. One account uses voucher checks and needs to be nudged a little south. When I go to print checks I have to be aware of what account I'm in and change the settings by hand to make sure the checks print correctly. How can I make the check-print settings stick with the account I'm using. It's a pain to have to remember every time. I'm frequently forgetting and screwing up a pag...

Check Names = "Exchange Server computer is busy..."
Here's what I got: Active Directory on Server 2003 1 Domain Controller also running DNS and WINS No other DNS or WINS servers (I know, I know) Static IP Addresses...NO DHCP Exchange Server 2003 on a member server Client running W2K SP4 Outlook 2000 SP3 Exchange has 4 mailboxes set, but nobody is using it. I'm still testing things out. When I try to connect to Exchange via my Outlook 2000, I get the following message: "The function cannot be performed because the Microsoft Exchange Server computer is busy. Try again later" I've tried it from 3 different client comp...

selecting print area via inputbox
I am trying to do something that seems quite simple, yet I can't get it to work. I am using the following code to get the print range from the user. Sometimes it works, and other times nothing happens, depending upon the range that is selected. Any ideas? Sub SelectPrintRange() Dim rRange As Range On Error Resume Next Application.DisplayAlerts = False Set rRange = Application.InputBox(Prompt:= _ "Please use your mouse to select a select a range to be printed.", _ Title:="SPECIFY RANGE", Type:=8) On Error...

Employee Check Format-Graphical
Does anyone know of a TK that shows how to convert one of the employee check from a text report to a graphical report? We do not have Direct deposit, I looked in the Report Downloads from Great Plains and did not see one there either. thanks -- Doug There's no secret here. Just un-check the "Text Report" option in the Report Definition window. And then modify the report so it looks like you want it. This will take some time. The reports don't transfer from text to graphical nicely. "Doug" wrote: > Does anyone know of a TK that shows how to convert...

page sees session variable as null until refresh
I’m having a problem with a web app that sees a session variable as null until a page reload. These are the steps: 1. Web app loads an array of string data into a session variable 2. Go to another page using response.redirect(“mynextpage.aspx”) 3. Return to current page using window.open(“mypage.aspx”,”_self”) call in javascript file 4. Upon returning, process initially sees session variable as null (this is not good); 5. refresh page using browser green arrows button, process now sees session variable as not null, and contains the array (this is what I need) Other items:...

Printing MICR checks
Hello, We are having an issue printing checks on the Select Payables Checks window. When we try to print the checks we receive the error message below: "Warning: You have MICR but are not in a MICR screen. To use MICR, abort this screen and set up security access." The user has access to this screen but I'm not sure what this error message means. There was nothing related to this in the Knowledge Base either. Has anyone else received this error message before and if so how did/do you resolve it? Thanks! The user has the third party mekorma check writing module ...

Check off boxes
Publisher 2003 in use. I am creating a questionnaire that will be included in a newsletter. I am using the publisher software to make this form. Somewhere, in the past, I saw a keyboard shortcut to inset checkoff boxes, however, I cannot remember the key strokes. Any help along this line will be greatly appreciated. Thank you and enjoy your day. Mike Mike Reshetar wrote: > Somewhere, in the past, I saw a keyboard shortcut to inset checkoff boxes, > however, I cannot remember the key strokes. Use Wingdings and the � or q characters. -- Ed Bennett - MVP Microsoft Publisher h...

Query on two tables with matching null fields
Suppose I have two tables: Table 1: ID a b c 1 1 2 2 3 4 3 5 6 4 7 8 9 Table2 ID a b c 1 1 2 2 3 4 3 5 6 4 7 8 9 The following SQL: SELECT Table1.ID, Table2.ID FROM Table1 INNER JOIN Table2 ON (Table1.c = Table2.c) AND (Table1.b = Table2.b) AND (Table1.a = Table2.a); Returns: Table1.ID Table2.ID 4 4 I do want these tables connected by inner joins not left or right (in other words I want only those records where all t...

check check check
afpoiadshfpaosid It is a feature, not a bug -- Message posted from http://www.ExcelForum.com ...

Upper case a worksheet
This is a multi-part message in MIME format. ------=_NextPart_000_00B7_01C3ECC4.5CECE500 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have an excel file that is upper/lower in case. I need to make this = file (columns B, C, D, E & F)=20 all upper case. I realy don't understand what the help window is trying = to tell me. Will someone please show or tell me how to go about this. Diane ------=_NextPart_000_00B7_01C3ECC4.5CECE500 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-print...

spam properties check
When I receive a suspecious email (spam), I right click, without opening the message, to check the properties to make sure it is spam before I forward to the "missed spam" software of my ISP. Some spam emails then ask me if "I want to save the changes" before I close the properties box. I am then not able to forward this email without replying yes to "save the changes?" I did not make any changes, I just checked the properties. Why is this happening? ...

Auto Word Select #3
Hi, I need to know how i can get a list of words to act as auto selects, so that i dont need to type them constantly across my worksheet. I heard that i need a combo box. i am using excel 2000. Thanks for your help. ...

tristate check box #2
I have a tristate check box.The default behavour of tristate check box in windows is that, the grayed check box will become unchecked after click on grayed check box. But i want , the grayed check box will become checked after click on grayed check box in VC++ .Pls help me its urgent. Well, for Win32, you can always SendMessage the button a BM_GETSTATE. I'm sure with MFC there's a function that will permit this; it could be as simple as button_name.GetState(). Well, for the event OnClick for that button, you can get the state of the button and then either run it through some if-...

How to find selected row?
I went through all properties searching for Selected or ActiveRow but I cannot find it. Jack Hello Jack, How exactly would you like this information? If you're talking about while looking at the worksheet, take a look directly left of the formula bar in the Name box. There you'll see the active cell's address. If you're talking VBA, then you can use Activecell.row, Activecell.column or Activecell.Address. Remember the first two will give you numeric returns while the last example will be a string (address). Hope this is what you're referring to, you were not...

Check scanning and Check readers
Has any group successfully integrated a check reader or scanner into a MSFT RMS-POS solution? Our small business processes alot of checks from contracts and cash from customers. So, we need to integrate credit card, debit card, cash, and checks processing. I've been wanting to implement RMS but have been unsuccessful in locating info on any check readers and compatibility with RMS. Anyone with a solution to reading, scanning, and electronically verifying checks at the POS? Rms only supports check verification using PC Charge. Also, RMS only supports MICR (Magnetic Ink Character...

Check Void in Error
Our beloved cash admin voided SEVERAL checks in error. Is there a way to un-void them? They were historical checks, ie. not in the current period. Our bank isn't effected, but our ledger is. I'm pretty adept at Sql, what tables would I need to hit if I have to manually do this?? Thanks! ...

How to use "Print_Area" to select my range.
I'm currently using this structure to define my range: Dim myRng As Range With Worksheets("Education") Set myRng = .Range("A4", "A74") End With However, the last cell in the range I need (A74 in this case), changes depending on the size of my print area. Is there a way to change the above so that the last cell in the range is 16 cells above the last row in my print area? Many Thanks. Tom Morris Tom, Use the following function to get the last row for all print areas on the sheet. Substract 16 from the result. The function returns 0 if an error occurs. &...

How do I change the color for cell selection in excel?
I just started using Excel 2007. In the older versions when I select a row, column, or specific group of cells, Excel would highlight the group in a certain color. In Excel 2007, it simply surrounds the selected group of cells with a thick black line. I've tried going into Excel Options under Advanced but couldn't find how to do this. Can you assist me in changing this feature? On Dec 31 2007, 6:52 pm, dminliberty <dminlibe...@discussions.microsoft.com> wrote: > I just started using Excel 2007. In the older versions when I select a row, > column, or specific grou...