Kamis, 07 Juli 2016

Re: [MS_AccessPros] Status Box

 

Thank you John!! I appreciate you help. Hope the weather is nice in Paris. We are hot in the southern US and have more than our share of humidity.


Doyce



---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Doyce-

Open fires first - the form is about to open, and you can cancel it.  At Load, the form is opening, and the recordset is in the process of "loading".  Referencing any control in Open forces the form to finish loading, and the Requery (wasn't sure that would work in Open) causes the recordset to be re-evaluated.  Because you have forced a value into the option group, the recordset opens properly filtered.

No, the events don't necessarily fire in the sequence listed in the Properties window.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 7, 2016, at 9:42 PM, winberry.doyce@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



John,


That works! Thanks. 


Please clarify for me though, when opening forms and reports when to use the on load event and when to use on open. What is the difference and which fires first? Another question, any chance that the events fire in the order that they are listed in the property sheet?


Doyce



---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Doyce-

I suspect the form's Record Source is being resolved before the option group default value is set.  That results in no records because it's testing for a Null value.  And the same is probably happening with the Row Source of the combo box if it's filtered on the option group.  It's a timing issue, so I'm at a loss as to what to try.  I might be tempted to do this in On Open:

    Me.StatusBox = 1
    Me.Requery


John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 7, 2016, at 9:25 PM, winberry.doyce@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



John,


Here is the code from the combo box after update:

If Len(cboEE & vbNullString) <> 0 Then
Me.Filter = ""
Me.FilterOn = True
Me.Recordset.FindFirst "[EEID-1] = " & Me.cboEE & ""
End If


Here is code from the after update of the option group:

Me.Requery
Me.cboEE.Requery


Here is the SQL for the form record source:

SELECT Employees.*, Employees.EEStatus
FROM Employees
WHERE (((Employees.EEStatus)=[Forms]![frmEmployees]![StatusBox]))
ORDER BY Employees.LASTNAME, Employees.FIRSTNAME;


The form does open showing no records. Allow Additions is set to yes.
    

Doyce



---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Doyce-

What code runs when you update either the option group or the combo box?  Does the form open showing no records?  If so, it could be that because the form doesn't allow additions (I'm assuming) and no record exists in the recordset, that the Row Source of the combo doesn't get queried.  Just a guess.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 7, 2016, at 8:19 PM, winberry.doyce@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



John,

The option group has a default value of 1. The combo box is not bound. What else can I check?

Doyce



---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Doyce-

Is the combo box bound?  It shouldn't be.  Consider also setting a default value for the option group.

John Viescas

Sent from my iPad

On Jul 7, 2016, at 20:07, winberry.doyce@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


Hello Pros,

I have created a database to track employees and their reviews. I have created a form to review and edit employee information. The form has an option group to filter the records by Active, Inactive or terminated employees Active (1) is the default. Then I have a combo box to look up employees by last name. The problem is that when the form is opened, the combo box doesn't work until I change the option group. Then it works perfectly. What do I need to do to get the combo box to work without having to change the option group first?

Doyce










__._,_.___

Posted by: winberry.doyce@con-way.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (9)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar