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
|
|||
|
|||
View Records for Editing Only
Hi,
I have been working on a filter problem and the post I was working from hasn't received any replies and as I've worked out some of the problems, I thought I would repost with the one left that is causing the most difficulty. I have a main form, with subform. The subform has a field "JobNumber" that when clicked will open a form "fWorkLogReminder" with null values in "StopTime" for specific field "Tech" from combo on main form. All works great - except - when no records match (Tech has no empty StopTimes) and the form still opens with a blank entry screen that says 1 of 1. Can't add to it (don't want to) - it just shows blank form. I don't want the user to have this annoyance of blank screen to close. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder", , , , acFormEdit Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub The query for fWorkLogReminder references the Tech from the main form in the criteria grid. I have worked on this for quite some time and have found no solution. If anyone can help, it will be greatly appreciated!! Thanks, Pam |
#2
|
|||
|
|||
View Records for Editing Only
hi .. I have done a similar solution for a client and I suggest you
write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method and if no records are found then I would msgbox the user telling them so, otherwise have the form pop up. PHisaw wrote: Hi, I have been working on a filter problem and the post I was working from hasn't received any replies and as I've worked out some of the problems, I thought I would repost with the one left that is causing the most difficulty. I have a main form, with subform. The subform has a field "JobNumber" that when clicked will open a form "fWorkLogReminder" with null values in "StopTime" for specific field "Tech" from combo on main form. All works great - except - when no records match (Tech has no empty StopTimes) and the form still opens with a blank entry screen that says 1 of 1. Can't add to it (don't want to) - it just shows blank form. I don't want the user to have this annoyance of blank screen to close. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder", , , , acFormEdit Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub The query for fWorkLogReminder references the Tech from the main form in the criteria grid. I have worked on this for quite some time and have found no solution. If anyone can help, it will be greatly appreciated!! Thanks, Pam |
#3
|
|||
|
|||
View Records for Editing Only
Thanks for replying. Would you mind explaining in detail or code how you did
this? You lost me with "write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method ". Thanks, Pam " wrote: hi .. I have done a similar solution for a client and I suggest you write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method and if no records are found then I would msgbox the user telling them so, otherwise have the form pop up. PHisaw wrote: Hi, I have been working on a filter problem and the post I was working from hasn't received any replies and as I've worked out some of the problems, I thought I would repost with the one left that is causing the most difficulty. I have a main form, with subform. The subform has a field "JobNumber" that when clicked will open a form "fWorkLogReminder" with null values in "StopTime" for specific field "Tech" from combo on main form. All works great - except - when no records match (Tech has no empty StopTimes) and the form still opens with a blank entry screen that says 1 of 1. Can't add to it (don't want to) - it just shows blank form. I don't want the user to have this annoyance of blank screen to close. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder", , , , acFormEdit Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub The query for fWorkLogReminder references the Tech from the main form in the criteria grid. I have worked on this for quite some time and have found no solution. If anyone can help, it will be greatly appreciated!! Thanks, Pam |
#4
|
|||
|
|||
View Records for Editing Only
Use the Form's Open event.
Test to see if there are any records in the form's recordset. If there are none, present a message box and cancel the open. Canceling the open actually closes the form: Private Sub Form_Open() If Me.Recordset.Recordcount 1 Then Cancel = True MsgBox "No Records For this Form" End If End Sub "PHisaw" wrote: Thanks for replying. Would you mind explaining in detail or code how you did this? You lost me with "write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method ". Thanks, Pam " wrote: hi .. I have done a similar solution for a client and I suggest you write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method and if no records are found then I would msgbox the user telling them so, otherwise have the form pop up. PHisaw wrote: Hi, I have been working on a filter problem and the post I was working from hasn't received any replies and as I've worked out some of the problems, I thought I would repost with the one left that is causing the most difficulty. I have a main form, with subform. The subform has a field "JobNumber" that when clicked will open a form "fWorkLogReminder" with null values in "StopTime" for specific field "Tech" from combo on main form. All works great - except - when no records match (Tech has no empty StopTimes) and the form still opens with a blank entry screen that says 1 of 1. Can't add to it (don't want to) - it just shows blank form. I don't want the user to have this annoyance of blank screen to close. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder", , , , acFormEdit Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub The query for fWorkLogReminder references the Tech from the main form in the criteria grid. I have worked on this for quite some time and have found no solution. If anyone can help, it will be greatly appreciated!! Thanks, Pam |
#5
|
|||
|
|||
View Records for Editing Only
Klatuu,
Thank's so much for picking up post. Your answers are most helpful. I had something similar set up with Recordcount = 0 with cancelling open. I set it to what you have listed and when I click the job number, even when I know there are records, I get the message "The Open Form action was cancelled." I think I have two different events conflicting each other and am not sure how to bring them together. I don't really need the message "no records" I just need for it to open to the record with StopTime blank so tech can close out before opening another job. I have listed code for each. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder" Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub Private Sub Form_Open(Cancel As Integer) If Me.RecordsetClone.RecordCount = 1 Then Cancel = True End If End Sub Again, thanks for your help. Pam "Klatuu" wrote: Use the Form's Open event. Test to see if there are any records in the form's recordset. If there are none, present a message box and cancel the open. Canceling the open actually closes the form: Private Sub Form_Open() If Me.Recordset.Recordcount 1 Then Cancel = True MsgBox "No Records For this Form" End If End Sub "PHisaw" wrote: Thanks for replying. Would you mind explaining in detail or code how you did this? You lost me with "write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method ". Thanks, Pam " wrote: hi .. I have done a similar solution for a client and I suggest you write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method and if no records are found then I would msgbox the user telling them so, otherwise have the form pop up. PHisaw wrote: Hi, I have been working on a filter problem and the post I was working from hasn't received any replies and as I've worked out some of the problems, I thought I would repost with the one left that is causing the most difficulty. I have a main form, with subform. The subform has a field "JobNumber" that when clicked will open a form "fWorkLogReminder" with null values in "StopTime" for specific field "Tech" from combo on main form. All works great - except - when no records match (Tech has no empty StopTimes) and the form still opens with a blank entry screen that says 1 of 1. Can't add to it (don't want to) - it just shows blank form. I don't want the user to have this annoyance of blank screen to close. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder", , , , acFormEdit Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub The query for fWorkLogReminder references the Tech from the main form in the criteria grid. I have worked on this for quite some time and have found no solution. If anyone can help, it will be greatly appreciated!! Thanks, Pam |
#6
|
|||
|
|||
View Records for Editing Only
Are you sure you want = 1?
That would mean the form would not open if there is 1 record. I have no idea why you are getting that message. "PHisaw" wrote: Klatuu, Thank's so much for picking up post. Your answers are most helpful. I had something similar set up with Recordcount = 0 with cancelling open. I set it to what you have listed and when I click the job number, even when I know there are records, I get the message "The Open Form action was cancelled." I think I have two different events conflicting each other and am not sure how to bring them together. I don't really need the message "no records" I just need for it to open to the record with StopTime blank so tech can close out before opening another job. I have listed code for each. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder" Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub Private Sub Form_Open(Cancel As Integer) If Me.RecordsetClone.RecordCount = 1 Then Cancel = True End If End Sub Again, thanks for your help. Pam "Klatuu" wrote: Use the Form's Open event. Test to see if there are any records in the form's recordset. If there are none, present a message box and cancel the open. Canceling the open actually closes the form: Private Sub Form_Open() If Me.Recordset.Recordcount 1 Then Cancel = True MsgBox "No Records For this Form" End If End Sub "PHisaw" wrote: Thanks for replying. Would you mind explaining in detail or code how you did this? You lost me with "write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method ". Thanks, Pam " wrote: hi .. I have done a similar solution for a client and I suggest you write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method and if no records are found then I would msgbox the user telling them so, otherwise have the form pop up. PHisaw wrote: Hi, I have been working on a filter problem and the post I was working from hasn't received any replies and as I've worked out some of the problems, I thought I would repost with the one left that is causing the most difficulty. I have a main form, with subform. The subform has a field "JobNumber" that when clicked will open a form "fWorkLogReminder" with null values in "StopTime" for specific field "Tech" from combo on main form. All works great - except - when no records match (Tech has no empty StopTimes) and the form still opens with a blank entry screen that says 1 of 1. Can't add to it (don't want to) - it just shows blank form. I don't want the user to have this annoyance of blank screen to close. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder", , , , acFormEdit Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub The query for fWorkLogReminder references the Tech from the main form in the criteria grid. I have worked on this for quite some time and have found no solution. If anyone can help, it will be greatly appreciated!! Thanks, Pam |
#7
|
|||
|
|||
View Records for Editing Only
Wait, I just thought of something.
I know that if you open a report with no records and use the NoData event to close the form, it will throw a 2501 error. Even though you have canceled the report, it still throws the error and you have to trap for it in the calling routine. I would step through the code in debug mode and see if this is what is happening. Here is how I trap for it in a report: PrintReport_Error: If Err.Number 2501 Then MsgBox "Error " & Err.Number & " (" & Err.Description & _ ") in procedure PrintReport of VBA Document Form_frmUPOReports" End If GoTo PrintReport_Exit End Sub "PHisaw" wrote: Klatuu, Thank's so much for picking up post. Your answers are most helpful. I had something similar set up with Recordcount = 0 with cancelling open. I set it to what you have listed and when I click the job number, even when I know there are records, I get the message "The Open Form action was cancelled." I think I have two different events conflicting each other and am not sure how to bring them together. I don't really need the message "no records" I just need for it to open to the record with StopTime blank so tech can close out before opening another job. I have listed code for each. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder" Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub Private Sub Form_Open(Cancel As Integer) If Me.RecordsetClone.RecordCount = 1 Then Cancel = True End If End Sub Again, thanks for your help. Pam "Klatuu" wrote: Use the Form's Open event. Test to see if there are any records in the form's recordset. If there are none, present a message box and cancel the open. Canceling the open actually closes the form: Private Sub Form_Open() If Me.Recordset.Recordcount 1 Then Cancel = True MsgBox "No Records For this Form" End If End Sub "PHisaw" wrote: Thanks for replying. Would you mind explaining in detail or code how you did this? You lost me with "write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method ". Thanks, Pam " wrote: hi .. I have done a similar solution for a client and I suggest you write a function which queries the table you are looking up for open issues and return a number which should represent a outstanding/open issues. You then will attach the function to the clicked method and if no records are found then I would msgbox the user telling them so, otherwise have the form pop up. PHisaw wrote: Hi, I have been working on a filter problem and the post I was working from hasn't received any replies and as I've worked out some of the problems, I thought I would repost with the one left that is causing the most difficulty. I have a main form, with subform. The subform has a field "JobNumber" that when clicked will open a form "fWorkLogReminder" with null values in "StopTime" for specific field "Tech" from combo on main form. All works great - except - when no records match (Tech has no empty StopTimes) and the form still opens with a blank entry screen that says 1 of 1. Can't add to it (don't want to) - it just shows blank form. I don't want the user to have this annoyance of blank screen to close. Private Sub JobNumber_Click() If IsNull(Forms!fWorkLog!StopTime) Then DoCmd.OpenForm "fWorkLogReminder", , , , acFormEdit Else DoCmd.OpenForm "fGeneralInfo", , , "JobNumber=" & Me!JobNumber End If End Sub The query for fWorkLogReminder references the Tech from the main form in the criteria grid. I have worked on this for quite some time and have found no solution. If anyone can help, it will be greatly appreciated!! Thanks, Pam |
Thread Tools | |
Display Modes | |
|
|