+ Reply to Thread
Results 1 to 10 of 10

remove database by command instead of clicking delete button

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    16

    remove database by command instead of clicking delete button

    i have made a excel sheet to store daily database. here i've uploaded this sheet.
    in this sheet there is two buttons, one for load data form and other is for remove database entry.
    my problem is that when i remove all the entry y clicking reset database command all the entries in the sheet are cleared
    but they are not removed from dataform. to remove them i have to remove them by clicking delete button and confirm the delete message.
    is there any command to delete this lines from database directly instead of delete them individually??
    i also want to add a facility to import export every day's record as xml file or any other format. Is this possible in excel.??

    database sheet.xls

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: remove database by command instead of clicking delete button

    when I remove all the entry by clicking reset button all the entries are removed from dataform.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    07-09-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: remove database by command instead of clicking delete button

    yes this is but it is very cumber sum because there is almost 250 entries per day and next day have to remove all entries..
    so there must be a command to do this job only by one click....

  4. #4
    Registered User
    Join Date
    07-09-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: remove database by command instead of clicking delete button

    all entries are gone but when you call data form by clicking form button there will be still blank database is exist and you have to edit each entry instead of click the new button.
    Last edited by dharmang1910; 08-25-2013 at 05:41 AM.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: remove database by command instead of clicking delete button

    Hi, dharmang1910,

    AFAIK the builtin DataMask doesnīt feature a DeleteAll. You have integrated a CommandButton to clear the contents which is one of the ways it could be done
    Please Login or Register  to view this content.
    Alterantives may be to add a column toi the data wirth the date and filter for that date via Criteria, to use the Advanced Filter with a criteria range on another sheet and copy only the data which is available or to maybe add some functionality that on opening the workbook the old data is cleared and the data for the actual day is inserted. As I donīt know how you imprt the data and from which file this code may show a way, procedure goes into ThisWorkbook:

    Please Login or Register  to view this content.
    You would need to alter the directory and the filename or have a dialog for choosing the file (GetOpenFilename or Application.Dialogs(xlDialogOpen)).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Registered User
    Join Date
    07-09-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: remove database by command instead of clicking delete button

    first of all thank you all for your reply, i've updated my user form so my delete database problem get solved but i need help in this matters...
    • need code that can display total of all entries in the textbox. here is the formula i need

      1000*texbox1.value+500*textbox2.value+100*textbox3.value...........+1*textbox9.value
    • want to prefix "dh" to all "Tr. no." so i only have to enter numbers.(transaction number format like dh12345)
    • want to import/export every day database record as xml or any other format.(i have once seen a excel file which have generate xml button which can generate xml file of database )
    • automatically add "0" to blank textbox at once by clicking ok button

    so please can anybody help me in this final coding of my project..???

    database sheet new.xls

    i have seen a code for generating xml is looks like this..
    Please Login or Register  to view this content.
    Last edited by dharmang1910; 08-25-2013 at 12:34 PM.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: remove database by command instead of clicking delete button

    Hi, dharmang1910,

    you would need to make the strings of the textboxes values for excel like using CDbl or CLng to convert them prior to writing the value to the cell.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Although I would prefer to use ListIndex = -1 for ComboBoxes.

    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    07-09-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: remove database by command instead of clicking delete button

    first of all thank you very much HaHoBe for your help.
    your method works great but after that i have set value property of all text box set the 0 in object browser which can be edited in form
    while data entering. i also add the me.txt1000r.setfocus code in cmdOKR_Click codes, so i can now continue add the data in database.
    i want now the "txttor" show realtime sum of other textbox value but i got error. here i have uploaded my sheet

    database sheet new1.xls

    i almost done my sheet. but in the last i got "run time error 424 object require"
    can someone please help me to remove this error..???

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: remove database by command instead of clicking delete button

    Hi, dharmang1910,

    I wouldnīt use the change-event (any empty textbox value will cause a RunTimeError) but use the Exit and check the length oif the cell prior to calling the procedure but thatīs up to your taste.

    Please Login or Register  to view this content.
    Ciao,
    Holger

  10. #10
    Registered User
    Join Date
    07-09-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: remove database by command instead of clicking delete button

    thank you HaHoBe very much,
    again your script works like a charm..
    i have used change event because i have used your this script,
    Please Login or Register  to view this content.
    so there is no posibility of empty text box....due to your valuable help, i am now able to complete my project..!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Reset Value in cells to 0 after clicking the command button
    By STU22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2012, 11:47 AM
  2. Exiting a cell when clicking on a command button
    By jcl20 in forum Excel General
    Replies: 1
    Last Post: 07-06-2008, 10:32 AM
  3. Changing cells color without clicking command button
    By grumpyguppy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-19-2008, 03:22 AM
  4. Double Clicking a Command Button
    By NewExcelUser in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2007, 01:37 AM
  5. Checkbox choices that run code on clicking command button
    By Sharky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2007, 05:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1