Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
short key to invoke command button in userform amit Excel Programming 5 May 11th 08 01:13 PM
Use Command Button from each Row to fill UserForm RyanH Excel Programming 0 September 20th 07 01:24 PM
userform command button checkbox problem [email protected] Excel Programming 1 February 1st 07 02:35 PM
need to minimize userform via command button on itself Jed[_3_] Excel Programming 1 August 10th 06 09:39 PM
Specifying a Command Button on a worksheet as differentiated from one on a UserForm Amber_D_Laws[_52_] Excel Programming 14 February 7th 06 03:43 PM


All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"