Userform Command Button not available until another command buttonhas been used
I have a userform that has an Add New Record command button and a
Submit command button. I don't want the Submit button to be available until/unless the Add New Record has been used. I'm not sure how to go about writing the code for that. Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed. |
Userform Command Button not available until another command button
I'd probably create a named range called EnableSubmit and change it when
needed. At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. I don't want the Submit button to be available until/unless the Add New Record has been used. I'm not sure how to go about writing the code for that. Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed. |
Userform Command Button not available until another commandbutton
On Sep 4, 11:02*am, Barb Reinhardt
wrote: I'd probably create a named range called EnableSubmit and change it when needed. * At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. *I don't want the Submit button to be available until/unless the Add New Record has been used. *I'm not sure how to go about writing the code for that. *Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed.- Hide quoted text - - Show quoted text - That sounds great but I can't get my head around it, do you have a minute that you could explain how I would do that or point me in the right direction? |
Userform Command Button not available until another command bu
This should help you get started.
Sub ReadSubmit() Dim Submit As String On Error Resume Next Submit = Evaluate(Names("Submit").Value) On Error GoTo 0 If Submit = "" Then Debug.Print "Named range submit doesn't exist" Else Debug.Print "Submit: " & Submit End If End Sub Sub DefineSubmit() Dim myName As String Dim myRefersTo As String 'Change submit to Yes myName = "Submit" myRefersTo = "=""Yes""" ThisWorkbook.Names.Add Name:=myName, RefersTo:=myRefersTo Call ReadSubmit 'Change submit to No myName = "Submit" myRefersTo = "=""No""" ThisWorkbook.Names.Add Name:="Submit", RefersTo:="=FALSE" End Sub -- HTH, Barb Reinhardt " wrote: On Sep 4, 11:02 am, Barb Reinhardt wrote: I'd probably create a named range called EnableSubmit and change it when needed. At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. I don't want the Submit button to be available until/unless the Add New Record has been used. I'm not sure how to go about writing the code for that. Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed.- Hide quoted text - - Show quoted text - That sounds great but I can't get my head around it, do you have a minute that you could explain how I would do that or point me in the right direction? |
Userform Command Button not available until another command bu
On Sep 4, 11:30*am, Barb Reinhardt
wrote: This should help you get started. Sub ReadSubmit() Dim Submit As String On Error Resume Next Submit = Evaluate(Names("Submit").Value) On Error GoTo 0 If Submit = "" Then * * Debug.Print "Named range submit doesn't exist" Else * * Debug.Print "Submit: " & Submit End If End Sub Sub DefineSubmit() Dim myName As String Dim myRefersTo As String 'Change submit to Yes myName = "Submit" myRefersTo = "=""Yes""" ThisWorkbook.Names.Add Name:=myName, RefersTo:=myRefersTo Call ReadSubmit 'Change submit to No myName = "Submit" myRefersTo = "=""No""" ThisWorkbook.Names.Add Name:="Submit", RefersTo:="=FALSE" End Sub -- HTH, Barb Reinhardt " wrote: On Sep 4, 11:02 am, Barb Reinhardt wrote: I'd probably create a named range called EnableSubmit and change it when needed. * At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. *I don't want the Submit button to be available until/unless the Add New Record has been used. *I'm not sure how to go about writing the code for that. *Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed.- Hide quoted text - - Show quoted text - That sounds great but I can't get my head around it, do you have a minute that you could explain how I would do that or point me in the right direction?- Hide quoted text - - Show quoted text - That definitely gets me started. I'm a VBA newbie so I understand what I need to do, but not how to get there. Thanks a million! |
All times are GMT +1. The time now is 09:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com