If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Filter
Hi,
I have the following code to prevent user going to new record when existing record is not complete. I'm not sure it is being used on correct event, but it is working somewhat the way I want. I have a main form "fSwithboard" with a combo box to list Tech names - "Combo8". There is a subform in datasheet view that list all jobs assigned to specific tech from Combo8. When the job number is clicked it opens form "fGeneralInfo". All works well - now I've added the strWhere and If statement. It will open the filtered form "fInProgressReminderRepair", but not Tech specific to Combo8. It lists all tech's with jobs that have StopTime as null. What I'm trying to do is when they click onto a new job, this form will popup to show they are still logged in on another job. I also want it to show this when the database is closed out each evening. Private Sub JobNumber_Click() Dim strWhere As String strWhere = "Forms!fSwitchboard!Combo8 = '" & Forms!fInProgressReminderRepair!Tech & "'" If IsNull(Forms!fInProgressReminderRepair!StopTime) Then DoCmd.OpenForm "fInProgressReminderRepair", , , strWhere Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub If anyone will tell me how to revise this code to make it work properly, it will be very much appreciated. Thanks in advance, Pam |
#2
|
|||
|
|||
Filter
What I'm trying to do is when they click onto a new job, this form will popup to show they are still logged in on another job. I also want it to show this when the database is closed out each evening. Why not use DCount and filter for open calls and TechID is a match? Then if you get something other than zero, you open your form that's not complete? |
#3
|
|||
|
|||
Filter
Thanks for the reply. I'm not familiar with using DCount. Mind explaining?
Pam " wrote: What I'm trying to do is when they click onto a new job, this form will popup to show they are still logged in on another job. I also want it to show this when the database is closed out each evening. Why not use DCount and filter for open calls and TechID is a match? Then if you get something other than zero, you open your form that's not complete? |
#4
|
|||
|
|||
Filter
Since I couldn't get the strWhere to work in the original code, I have
changed process. I created a separate form and query with the same info, but for the query I placed in the critera grid "Forms!fSwitchboard!Combo8" to match the Tech to the form. It works partially the way I want it to. The form will open with null StopTime if the tech forgot to sign out and limits to only his records, but when the tech doesn't have any open time the form still opens and they have to close an empty form. Is there a way to prevent this from opening when there are no open StopTime records? Also, I need to keep a form open for filtering on StopTime. How do I open a hidden form when the switchboard opens? Thanks for any help, Pam " wrote: What I'm trying to do is when they click onto a new job, this form will popup to show they are still logged in on another job. I also want it to show this when the database is closed out each evening. Why not use DCount and filter for open calls and TechID is a match? Then if you get something other than zero, you open your form that's not complete? |
Thread Tools | |
Display Modes | |
|
|