Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suggestion please... 2

Status
Not open for further replies.

Chummly66

MIS
Feb 19, 2005
106
US
I'm trying to do something and am not sure if you can do it. So, if anyone has a suggestion, I'd appreciate the input.

I made a simple form and table where I create a To-Do list. I created a query which lists "open" or to-do items not yet completed. I then created another form which displays in a lsit box the query and thus, a to-do listing.

What I was wondering, is that I have a main form that displays as soon as the database opens, like a big navigator form. On the form, is a command button that opens the form to display the To-Do list. I would like this command button to "blink" thus notifying the user there is a To-Do task that should be looked at.

I was wondering if there was a way to look at the query, and if there is items that are listed by the query, the warning or whatever I decide to notify the user with, would occur. Otherwise, if the query is nul or empty of results, then no warning.

Again, any and all suggestions would be much appreciated.

RIchard
 
Maybe something like:
Code:
Private Sub Form_Load()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strSql As String
    
    Set db = CurrentDb
    strSql = "Select Count(*) As OpenRecs from tblToDo Where Done ='No'"
    Set rs = db.OpenRecordset(strSql)
    If rs!OpenRecs > 0 Then Me.cmdToDo.ForeColor = vbRed
End Sub
 
Also try using something like..
Code:
If DCount("*","YourQueryName" , "Done= 'No'") < 1 Then
Me.cmdToDo.ForeColor = vbRed
End If



________________________________________________________
Zameer Abdulla
Help to find Missing people
Do not cut down the tree that gives you shade.
 
ZmrAbdulla,

I tried your code, plugging in the actual name of the query and the correct button name, and I get the following error:

Runtime Error 2001
You cancelled the previous operation

Being a novice, my query only has three items:
ID
txtToDo
txtDateCompleted

My query is simple; if txtDateCompleted is Nul, then the task is open and thus displays. If txtDateCompleted has a date entered, then the task is completed.

So, I am not sure whether or not the "Done = No" line has anything to do with the error.

Richard


 
ReMou,

thanks for the suggestion. I tried your code and also keep getting an error:

runtime 3601
too Few Parameters. Expected 1

Being a novice, my query only has three items:
ID
txtToDo
txtDateCompleted

My query is simple; if txtDateCompleted is Nul, then the task is open and thus displays. If txtDateCompleted has a date entered, then the task is completed.

So, I am not sure whether or not the "Done = No" line has anything to do with the error.

Richard


 
It could have been clearer, 'Done' was just a symbol for what ever field showed that the task was completed. Using ZmrAbdulla suggestion:

DCount("*", "QueryName", "IsNull(txtDateCompleted)")

Will return the number of records that have not got a txtDateCompleted.
If it still does not work for you, please post the code you are using.
 
Remou

thanks!! Im sorry I am not that good at this stuff yet. That change worked perfectly. thank you!

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top