Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete a command button after first use 1

Status
Not open for further replies.

Eprice

Technical User
May 6, 2003
209
US
Hi,
I have a command button (cmdNAICS) that is importing data into a database. I only want them to use this button one time so i am trying to delete the button after the import is finished. The form is (frm MainMenu). I found code for DeleteControl but get different errors depending on what I try. Does anyone know the correct code to delete a button on a form that has already been created?
Thanks Lisa
 

Don't know about actually deleting the button, but you could simply set it's visible property to false. Make sure you set focus to another control first.


Randy
 
Yes, that works fine until they close the database and come back in. Then it is visible and enabled again.
Lisa
 
Add a field to the table bound to your form. Then add a checkbox to your form, bind it to that field. Add to your code that make the button not visible with me!checkbox.value=-1. Now the form can "remember" that you have completed the download. In the Onopen event of the form if me!checkbox=-1 then me!cmddownload.visible=false else me!cmddownload.visible=true.
 
Yes, I had already thought of that too but was trying to get it done with a couple lines of code. Thanks for the help.
Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top