A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Inactive delete feature



 
 
Thread Tools Display Modes
  #1  
Old October 26th, 2004, 06:31 PM
frepaci
external usenet poster
 
Posts: n/a
Default Inactive delete feature

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.
  #2  
Old October 26th, 2004, 09:55 PM
Mauricio Silva
external usenet poster
 
Posts: n/a
Default


This will deactivate your delete button
btnDelete.Active = false

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.


I am assumming:
1 - Your data is in a SubForm
2 - Toggle option 1: "Active", value =1 option 2: "Inactive", value =
anything else

SubForm1.Form.Filter = "Active = " & iif(Toggle1=1, "True", "False")
SubForm1.Form.FilterOn = True

If you data is in the same form, use
Me.Filter = "Active = " & iif(Toggle1=1, "True", "False")
Me.FilterOn = True

Take care
Mauricio Silva

"frepaci" wrote:

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.

  #3  
Old October 27th, 2004, 03:37 PM
Franca
external usenet poster
 
Posts: n/a
Default

Thanks for your help. My data is in the same form.

Am I supposed to create 2 toggle buttons, one for active and the other
inactive? If so where would I put the following information:

Toggle option 1: "Active", value =1 option 2: "Inactive"

Where do I assign it a value, in the properties of the button? Do I need
two toggle buttons? An active one and and Inactive one, so when the active
button is pressed it will show the records where the yes/no check box has not
been checked off and the opposite for the Inactive btn.

Is this the easiest way to do this, any suggestions would be appreciated.

Thanks

"Mauricio Silva" wrote:


This will deactivate your delete button
btnDelete.Active = false

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.


I am assumming:
1 - Your data is in a SubForm
2 - Toggle option 1: "Active", value =1 option 2: "Inactive", value =
anything else

SubForm1.Form.Filter = "Active = " & iif(Toggle1=1, "True", "False")
SubForm1.Form.FilterOn = True

If you data is in the same form, use
Me.Filter = "Active = " & iif(Toggle1=1, "True", "False")
Me.FilterOn = True

Take care
Mauricio Silva

"frepaci" wrote:

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.

  #4  
Old October 27th, 2004, 04:19 PM
Mauricio Silva
external usenet poster
 
Posts: n/a
Default

It seems to be easier for your to create an Option Group, following the wizard:
- Define two option: Active and Inactive.
- Choose your default choice: Active
- Assign values: Active = 1 Inactive = 2
- Choose: Save the value for later use
- Select toogle buttons
- Choose a caption: suggestion : Filter

In the event After_Update insert the commands:

Private Sub Frame1_AfterUpdate()
Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")
Me.FilterOn = True
End Sub

Obs.: Change Frame1 for the name of your new frame (Option Group object)

I think this is what your are looking for.

Take Care
Mauricio Silva



"Franca" wrote:

Thanks for your help. My data is in the same form.

Am I supposed to create 2 toggle buttons, one for active and the other
inactive? If so where would I put the following information:

Toggle option 1: "Active", value =1 option 2: "Inactive"

Where do I assign it a value, in the properties of the button? Do I need
two toggle buttons? An active one and and Inactive one, so when the active
button is pressed it will show the records where the yes/no check box has not
been checked off and the opposite for the Inactive btn.

Is this the easiest way to do this, any suggestions would be appreciated.

Thanks

"Mauricio Silva" wrote:


This will deactivate your delete button
btnDelete.Active = false

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.


I am assumming:
1 - Your data is in a SubForm
2 - Toggle option 1: "Active", value =1 option 2: "Inactive", value =
anything else

SubForm1.Form.Filter = "Active = " & iif(Toggle1=1, "True", "False")
SubForm1.Form.FilterOn = True

If you data is in the same form, use
Me.Filter = "Active = " & iif(Toggle1=1, "True", "False")
Me.FilterOn = True

Take care
Mauricio Silva

"frepaci" wrote:

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.

  #5  
Old October 27th, 2004, 06:43 PM
Franca
external usenet poster
 
Posts: n/a
Default

So I created the option group and added to code to the After_Update event.

But when I open the form and click on InActive or Active toggle buttons I
get a box asking me to Enter a Parameter Value for Active. When it asks me
to debug it points to the Me.FilterOn = True line.

I don't understand how these buttons tie to my yes/no field that displays
whether the record is active or not?

"Mauricio Silva" wrote:

It seems to be easier for your to create an Option Group, following the wizard:
- Define two option: Active and Inactive.
- Choose your default choice: Active
- Assign values: Active = 1 Inactive = 2
- Choose: Save the value for later use
- Select toogle buttons
- Choose a caption: suggestion : Filter

In the event After_Update insert the commands:

Private Sub Frame1_AfterUpdate()
Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")
Me.FilterOn = True
End Sub

Obs.: Change Frame1 for the name of your new frame (Option Group object)

I think this is what your are looking for.

Take Care
Mauricio Silva



"Franca" wrote:

Thanks for your help. My data is in the same form.

Am I supposed to create 2 toggle buttons, one for active and the other
inactive? If so where would I put the following information:

Toggle option 1: "Active", value =1 option 2: "Inactive"

Where do I assign it a value, in the properties of the button? Do I need
two toggle buttons? An active one and and Inactive one, so when the active
button is pressed it will show the records where the yes/no check box has not
been checked off and the opposite for the Inactive btn.

Is this the easiest way to do this, any suggestions would be appreciated.

Thanks

"Mauricio Silva" wrote:


This will deactivate your delete button
btnDelete.Active = false

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

I am assumming:
1 - Your data is in a SubForm
2 - Toggle option 1: "Active", value =1 option 2: "Inactive", value =
anything else

SubForm1.Form.Filter = "Active = " & iif(Toggle1=1, "True", "False")
SubForm1.Form.FilterOn = True

If you data is in the same form, use
Me.Filter = "Active = " & iif(Toggle1=1, "True", "False")
Me.FilterOn = True

Take care
Mauricio Silva

"frepaci" wrote:

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.

  #6  
Old October 27th, 2004, 07:09 PM
Mauricio Silva
external usenet poster
 
Posts: n/a
Default

Sorry, my fault

it is asking for a value for Active parameter because the field active
doesn't exist. In the line:

Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")

you also need to change the word Active to the name of your yes/no field

Mauricio Silva

"Franca" wrote:

So I created the option group and added to code to the After_Update event.

But when I open the form and click on InActive or Active toggle buttons I
get a box asking me to Enter a Parameter Value for Active. When it asks me
to debug it points to the Me.FilterOn = True line.

I don't understand how these buttons tie to my yes/no field that displays
whether the record is active or not?

"Mauricio Silva" wrote:

It seems to be easier for your to create an Option Group, following the wizard:
- Define two option: Active and Inactive.
- Choose your default choice: Active
- Assign values: Active = 1 Inactive = 2
- Choose: Save the value for later use
- Select toogle buttons
- Choose a caption: suggestion : Filter

In the event After_Update insert the commands:

Private Sub Frame1_AfterUpdate()
Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")
Me.FilterOn = True
End Sub

Obs.: Change Frame1 for the name of your new frame (Option Group object)

I think this is what your are looking for.

Take Care
Mauricio Silva



"Franca" wrote:

Thanks for your help. My data is in the same form.

Am I supposed to create 2 toggle buttons, one for active and the other
inactive? If so where would I put the following information:

Toggle option 1: "Active", value =1 option 2: "Inactive"

Where do I assign it a value, in the properties of the button? Do I need
two toggle buttons? An active one and and Inactive one, so when the active
button is pressed it will show the records where the yes/no check box has not
been checked off and the opposite for the Inactive btn.

Is this the easiest way to do this, any suggestions would be appreciated.

Thanks

"Mauricio Silva" wrote:


This will deactivate your delete button
btnDelete.Active = false

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

I am assumming:
1 - Your data is in a SubForm
2 - Toggle option 1: "Active", value =1 option 2: "Inactive", value =
anything else

SubForm1.Form.Filter = "Active = " & iif(Toggle1=1, "True", "False")
SubForm1.Form.FilterOn = True

If you data is in the same form, use
Me.Filter = "Active = " & iif(Toggle1=1, "True", "False")
Me.FilterOn = True

Take care
Mauricio Silva

"frepaci" wrote:

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.

  #7  
Old October 27th, 2004, 07:41 PM
Franca
external usenet poster
 
Posts: n/a
Default

Thanks, that worked great. The only thing is that the Active toggle button
displays the inactive records and the Inactive toggle button displays the
active ones. Is there any way to reverse this.

Also is there an easy way to add another toggle button that will display all
records. I find once you click on Active for example you can no longer see
all the records anymore. Maybe I should have Active, Inactive and All.

Thanks again for the help.

"Mauricio Silva" wrote:

Sorry, my fault

it is asking for a value for Active parameter because the field active
doesn't exist. In the line:

Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")

you also need to change the word Active to the name of your yes/no field

Mauricio Silva

"Franca" wrote:

So I created the option group and added to code to the After_Update event.

But when I open the form and click on InActive or Active toggle buttons I
get a box asking me to Enter a Parameter Value for Active. When it asks me
to debug it points to the Me.FilterOn = True line.

I don't understand how these buttons tie to my yes/no field that displays
whether the record is active or not?

"Mauricio Silva" wrote:

It seems to be easier for your to create an Option Group, following the wizard:
- Define two option: Active and Inactive.
- Choose your default choice: Active
- Assign values: Active = 1 Inactive = 2
- Choose: Save the value for later use
- Select toogle buttons
- Choose a caption: suggestion : Filter

In the event After_Update insert the commands:

Private Sub Frame1_AfterUpdate()
Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")
Me.FilterOn = True
End Sub

Obs.: Change Frame1 for the name of your new frame (Option Group object)

I think this is what your are looking for.

Take Care
Mauricio Silva



"Franca" wrote:

Thanks for your help. My data is in the same form.

Am I supposed to create 2 toggle buttons, one for active and the other
inactive? If so where would I put the following information:

Toggle option 1: "Active", value =1 option 2: "Inactive"

Where do I assign it a value, in the properties of the button? Do I need
two toggle buttons? An active one and and Inactive one, so when the active
button is pressed it will show the records where the yes/no check box has not
been checked off and the opposite for the Inactive btn.

Is this the easiest way to do this, any suggestions would be appreciated.

Thanks

"Mauricio Silva" wrote:


This will deactivate your delete button
btnDelete.Active = false

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

I am assumming:
1 - Your data is in a SubForm
2 - Toggle option 1: "Active", value =1 option 2: "Inactive", value =
anything else

SubForm1.Form.Filter = "Active = " & iif(Toggle1=1, "True", "False")
SubForm1.Form.FilterOn = True

If you data is in the same form, use
Me.Filter = "Active = " & iif(Toggle1=1, "True", "False")
Me.FilterOn = True

Take care
Mauricio Silva

"frepaci" wrote:

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.

  #8  
Old October 27th, 2004, 08:11 PM
Mauricio Silva
external usenet poster
 
Posts: n/a
Default

You just need to click in the toggle button at the toolbox and create it
directly inside the frame. It will be directly conected to de others toggle
button with the optionvalue = 3

You also will have to change the AfterUpdate code to:

if (Frame1.Value = 3 ) then
me.Filter = ""
else
Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")
end if

Me.filteron = true

Remenber to change the name of the frame1 and Active field
P.S. To correct the Active/Inactive reverse the true/false options
----
I'll tell you how I usually do when I have more than 2 options:
I create a combobox and assign the parameters:
Row Source Type = Value List
Row Source = 1;"Active";2;"Inactive";3;"All records"
Cound Column = 1
Limit to List = Yes
Column Count = 2
ColumnWidths = 0;1

Event AfterUpdate:

Select Case Combo01
Case 01: Me.filter = "Active = True"
Case 02: Me.filter = "Active = False"
Case 03: Me.filter = ""
End Select

me.FilterOn = true

Notes:
- Change Combo1 for the combo name
- Change Actiev for yes/No field name

Take Care

Mauricio Silva

"Franca" wrote:

Thanks, that worked great. The only thing is that the Active toggle button
displays the inactive records and the Inactive toggle button displays the
active ones. Is there any way to reverse this.

Also is there an easy way to add another toggle button that will display all
records. I find once you click on Active for example you can no longer see
all the records anymore. Maybe I should have Active, Inactive and All.

Thanks again for the help.

"Mauricio Silva" wrote:

Sorry, my fault

it is asking for a value for Active parameter because the field active
doesn't exist. In the line:

Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")

you also need to change the word Active to the name of your yes/no field

Mauricio Silva

"Franca" wrote:

So I created the option group and added to code to the After_Update event.

But when I open the form and click on InActive or Active toggle buttons I
get a box asking me to Enter a Parameter Value for Active. When it asks me
to debug it points to the Me.FilterOn = True line.

I don't understand how these buttons tie to my yes/no field that displays
whether the record is active or not?

"Mauricio Silva" wrote:

It seems to be easier for your to create an Option Group, following the wizard:
- Define two option: Active and Inactive.
- Choose your default choice: Active
- Assign values: Active = 1 Inactive = 2
- Choose: Save the value for later use
- Select toogle buttons
- Choose a caption: suggestion : Filter

In the event After_Update insert the commands:

Private Sub Frame1_AfterUpdate()
Me.Filter = "Active = " & IIf(Frame1 = 1, "True", "False")
Me.FilterOn = True
End Sub

Obs.: Change Frame1 for the name of your new frame (Option Group object)

I think this is what your are looking for.

Take Care
Mauricio Silva



"Franca" wrote:

Thanks for your help. My data is in the same form.

Am I supposed to create 2 toggle buttons, one for active and the other
inactive? If so where would I put the following information:

Toggle option 1: "Active", value =1 option 2: "Inactive"

Where do I assign it a value, in the properties of the button? Do I need
two toggle buttons? An active one and and Inactive one, so when the active
button is pressed it will show the records where the yes/no check box has not
been checked off and the opposite for the Inactive btn.

Is this the easiest way to do this, any suggestions would be appreciated.

Thanks

"Mauricio Silva" wrote:


This will deactivate your delete button
btnDelete.Active = false

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

I am assumming:
1 - Your data is in a SubForm
2 - Toggle option 1: "Active", value =1 option 2: "Inactive", value =
anything else

SubForm1.Form.Filter = "Active = " & iif(Toggle1=1, "True", "False")
SubForm1.Form.FilterOn = True

If you data is in the same form, use
Me.Filter = "Active = " & iif(Toggle1=1, "True", "False")
Me.FilterOn = True

Take care
Mauricio Silva

"frepaci" wrote:

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Function Franca Using Forms 1 October 27th, 2004 09:53 AM
Delete Query Shanin Running & Setting Up Queries 14 July 31st, 2004 07:15 PM
Delete Query cannot delete specified from specified tables... bbarkman General Discussion 2 July 8th, 2004 01:08 PM
Deleting Records does not Delete Records Lucky Man Cree New Users 7 July 6th, 2004 11:33 PM
Excel formula that will delete a row Bill Worksheet Functions 5 April 29th, 2004 10:21 PM


All times are GMT +1. The time now is 06:21 AM.


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