If IsNull(Forms("AccidentEntry").OpenArgs) = False Then
If Forms("AccidentEntry").OpenArgs = "InSearchMode" Then
Me.cboEmployeeName.RowSource = "SELECT EmpID, LastName & ', ' & FirstName AS Expr1, DateOfHire, Status FROM tblEmployees;"
End If
Else
Me.cboEmployeeName.RowSource = "SELECT EmpID, LastName & ', ' & FirstName AS Expr1, DateOfHire, Status FROM tblEmployees [COLOR="Blue"]WHERE Staus=FALSE[/COLOR];"
End If
Go direct....I'll forget about the qryActiveInactiveEmployees query because I can't remember what is in it
CyberLynx, well I tried the code and when i try to enter a new report a msg box comes up asking for the "Status" Here is what I have done to the DB. Thanks!
My apologies. I misspelled the Field name Status within the WHERE clause. Funny thing is....I even highlighted it blue
No worries though, it still wouldn't have supplied the desired result. It would have changed the Column Order within the Combo.
You are back to using your Query which is absolutely fine but if you look closely at the way you are doing it, you are using a query within a query. I feel this is unnecessary since if you are going to use a query object then have that query to the job all at once rather tan placing that query into yet another query. I makes no sense doing it this way. Well....in some ways it does and some ways it doesn't. Here is what I mean:
You current Query Object named qryActiveInactiveEmployees contains the following SQL String:
Code:
SELECT tblEmployees.EmpID, tblEmployees.FirstName, tblEmployees.LastName, tblEmployees.DateOfHire, tblEmployees.Status
FROM tblEmployees
WHERE (((tblEmployees.Status)=False));
Then you use this Query in yet another to format the output a particular way:
Code:
"SELECT qryActiveInactiveEmployees.EmpID, [LastName] & ', ' & [FirstName] AS Expr1, qryActiveInactiveEmployees.DateOfHire FROM qryActiveInactiveEmployees;"
In essence, this is a SELECT query within a SELECT query. This can all be accomplished in one or the other. You don't need both For Example, place the following into the SQL view of your qryActiveInactiveEmployees query (place this object into Design View | right click in the query editor | select SQL View):
SELECT LastName & ", " & FirstName AS FullName, *
FROM tblEmployees
WHERE Status=FALSE
ORDER BY LastName;
One query....not two. Of course you will also need to change some properties for the Combo and Column references for other controls getting filled by the Combo Data. It may be more hassle than what you are up to but....it's food for thought.
In any case...Your DB is appears to be working. Good show.
On another note: I did like the Border you had on the AI Report entry Form in previous versions. It was consistent with the Format you have with the Switch-Board Form although I couldn't understand why you were using brown colored boxes surrounding the SubForm when you could have just set the Background color of the Main Forms' Detail Section to brown.