Delete From Database With Userform
Nov 12, 2006
Using the code below, I search a database (Sheet1) on a pallet number and display in the listbox all the items on that pallet.
Assuming now that the pallet has been "worked" or despatched, what code would I use to delete that pallet and all its items from the database?
Private Sub cmdFindAllPal_Click() 'Find all Pallet
Dim FirstAddress As String
Dim strFind As String 'what to find
Dim rSearch As Range 'range to search
Dim fndA, fndB, fndC, fndD As String
Dim head1, head2, head3, head4 As String 'headings for list
Dim i As Integer
i = 1
Set rSearch = Sheet1.Range("b7", Range("b65536").End(xlUp))
strFind = Me.TextBox2.Value
With rSearch
Set c = .Find(strFind, LookIn:=xlValues, LookAt:=xlWhole)...........
View 9 Replies
ADVERTISEMENT
Aug 2, 2009
I have a ListBox in a UserForm that displays multiple branches. I can't figure out the code to delete the selected record? if the user selects "Yes" from the MsgBox?
View 6 Replies
View Related
Dec 21, 2006
I'm creating an Excel UserForm where the user can view, edit, and delete records they've entered.
The following code is for Deleting a selected record, and it IS WORKING. But it seems TOO SIMPLE and I want to be sure it's correct and not leaving any loose ends in the Database file that could cause corruption later on....
Sub vCLdbDel()
Dim cnt As ADODB.Connection
Dim dbPath, dbName As String
Dim stSQLAs String
Dim stCon As String
Dim dbid As Long
Run "setvars"
'Get the dbID from the selected Item in the list
With vCL.CLdbList
dbid = .List(.ListIndex, 6)
End With
'Path & FileName to the Database File
dbPath = M. Range("G2").Value
dbName = M.Range("G3").Value
View 7 Replies
View Related
Feb 12, 2014
I have created a form that will add new records to a database. On the database there is a predetermined ticket number. The "Create" form looks for the first blank row and adds the information on the form the database.
What I am trying to make happen is when a "Ticket Number" is entered in the appropriate field on the "edit" form, the "Date Raised" and "Raised By" fields populate based on the information stored on the row for the ticket number enter.
View 3 Replies
View Related
Feb 12, 2010
I have created a userform on the "Database" sheet that has a listbox at the bottom that populates with records when I search for someone using the 'Name' box.
The problem that I am having is that when I enter "Person" and get the 30-odd records appear in the listbox, I click on say Person 5 BUT the userform fields do not update themselves fully with the correct information.
I found the following thread ....
View 10 Replies
View Related
May 19, 2014
when "Update"(code is under "Update"button) button is pressed to copy the data from userform to the database sheet exactly into columns where both column heading match, for example if userform has heading "Qty Received " all data from that column should be in the database column with the same header "Qty Received"
I attached my file when you will open the file you will find screenshot how it should look.
View 14 Replies
View Related
Jul 21, 2014
I am trying to create a relatively small database that is updated by users through a userform, but also has the capability to have columns (attribute categories) added or deleted without code modification.
I think my starting point, though it works for the simple case of no updates without code modification, is not good for my actual goal.
View 1 Replies
View Related
Jan 17, 2009
I have a database of 13 columns and ever increasing rows.
I want the following to be there on my userform.
1 combobox: showing the list of categories from which to search.(The categories are the column headings in columns A1 to A13.The user will have to select one category.
1 textbox:Here the user will enter the search term.
1 Command Button: When the command button is clicked/entered, the code shall be such that it will search in the column corresponding to the category mentioned in the combobox and display the results( The entire 1 row x 13 cloumns containing the search term) in a Listbox. If the search term does not matches then a message box should appear with the message "No entries found"
[b]
1 Listbox:to display the search result as mentioned above.
View 13 Replies
View Related
Dec 28, 2009
I am working on a label printing set-up for my work. So far I have completed the userform that formulas will be entered on and printed from. I had an idea of being able to save these formulas for recall later. I included “Save” and “Recall” buttons on the userform. My plan is to have my co-workers click on the “save” button and be able to enter an additional piece of data and have everything saved to another worksheet labeled “database”. If you look at the said sheet you will see a column for “customer”, “color” and then the colorants. Due to the wide variety of colorants and quantities available, I set it up so that I have the colorant and under that Oz and 48ths. I am trying to figure out a code that will populate that across the row.
Then I want to be able to push “recall”, find my customer and then color in a combobox and have that populate my label.
At this time I am stuck. Part of my problem is I don’t quite know the terminology to google.
Attached is the file I am working with. The only sheets that need concern anyone are "main" and "database". The others are from the original file and I will be deleting those once I am done.
View 11 Replies
View Related
Jul 19, 2006
Userform Loading with database turns to close all Excelworkbooks completely
Database created in Excel worksheets to load and show in various different objects on userform. At present this project file size is approximately 2.5 mb and more to go as it is not yet complete. Now you can imagine how much big this project can be.
It uses various different types of objects such as listboxes with many columns, combo-boxes, textbox, checkbox and many. Every objects has its own style to display data on userform which is set in its properties itself.
Before loading userform to display, program creates database from manual entry (which is made by user on their working sheets) to database entry sheets (which is made to make compatible to show on userform). Upon loading, it also loads/populate all datas required in their objects to display.
All works perfect when I am in editing mode. It doesn't matter how big the database can be and works as required. This Project is now Password Protected and distributed among all staffs in our company to work with.
Error Occurs, when I tested in non-editing mode. The moment I triggered the macro to load the program, it takes some few times and pops-up with Excel Recover error message box asking whether to send Error Report and to whether recover & start Excel application again??
I don't know what is wrong. Sometimes it also run successfully when in non-editing mode even there is no changes in program codes.??
Sometimes I feel there can be a virtual memory issue, but my Pc is more than enough with 1GB ram. I hv also increased virtual memory limits and tested but all vain attempt...
View 9 Replies
View Related
Apr 30, 2012
Any code for deleting empty rows from a database, without sorting the database.
I am trying to do a for..next loop going through each row but can't work out the code to check each row as to whether it is blank.
View 4 Replies
View Related
Aug 4, 2006
Currently I have a database in an Excel template. After a user creates a new workbook from the template, a macro button on sheet 1 brings up a window (a userform) to allow selection of items from the database sheet. The item selected is entered on sheet 1 by means of VLookup. That works fine, but to edit the database correctly it is necessary to open the template itself. This is not a user-friendly method.
I figure the best way to solve this dilemma is to separate the template from the database. That is, make the database sheet into a workbook. This I've done. Here's the problem: What code is there that links the list box in the userform (of the template) with the closed database workbook? Is it even possible? If a file path type code is required, it may work on my computer, but when I use my template and database on another computer, the code doesn't work.
Another problem, and similar is this: I'd like to be able to have a macro button that opens the database from the new workbook (which was created from the template) in order to edit the database. If having a template seems to be my problem, I must have it since each workbook created from it is a different project.
View 3 Replies
View Related
Jan 15, 2014
Below is my current code. The strFind1 searches for a name within the database and then I need strFind2 to do a exact for a Subproject search and a partial search for everything containing the Subproject selected and other Subprojects. Currently, when the database entry in the worksheet includes Subproject 1 the search function works but when I have an entry that contains Subproject 1/Subproject 4 it does not find the entry. How can I expand the strFind2 to equal what is selected in the Combobox2 and find entries that have what is selected plus more text. I have set the line where I think everything is going wrong to a bold format.
[Code] .....
View 2 Replies
View Related
Feb 15, 2010
I would like to add a piece of code into the user form that will check and verify if a part has already been added so as to avoid multiples in a user-driven/created database.
here is a repost of the current code i am using for the user form (I have posted it before in another thread .. Blane245 helped me out with a different question I had)
View 7 Replies
View Related
Feb 16, 2008
I have a list box that I'm using to pull customer information from my "Customer" sheet to my "Invoice" sheet. I can actually open, select, and close the userform. However, I can't get the macro to put the information into the specified location on my "Invoice" sheet.
Here's my code so far:
Private Sub Cancel_Click()
Application.ScreenUpdating = False
Unload Me
End Sub
Private Sub customer_Change()
End Sub
Here is the "Customer" sheet I'm pulling the info from:
And here is the location on the "Invoice" sheet that I'm trying to direct the userform to:
And here's my userform just for reference:
The userform works perfectly until I press the OK button. That's when I get the error.
View 9 Replies
View Related
Mar 31, 2004
I am currently trying to create a database of products for my company. For each product I would like to include an image associated with it. I then want to have on another sheet a place where the user will click an error and be able to cycle through the products. As tehy cycle the associated image will pop up.
What I need to understand is after importing the image into excel, how do I associate that image to a cell so I can reference it in another sheet of the database. I am not concerned with how large the database will get, my pictures are quite small.
View 4 Replies
View Related
Nov 7, 2008
I'm trying to lookup a database named database and return a time in column A, based on criteria in cells a1 and b1 on another sheet, A1 would contain a number and B1 would contain a day from mon-fri
eg of Database
A B C D E F G
10:00 5000 Mon Tues
11:00 5000 Wed Thur Fri
and so on
if a1= 5000 & b1=Wed
how can I return 11:00
I have tried index and match =index(a:a,match(a1&b1,b:b&e:e,0))
View 9 Replies
View Related
Oct 17, 2013
I've used a countifs, but I'm having trouble doing a sum in a similar way. I have 2 databases and I will try to explain below. I need the to sum the values of database 1 if the second database is >= 20. So the value I would expect on this example would be 900. I would also like to be able to highlight which ones are elliminated. Such as coloring the text red.
Database 1
Eric 100
Jenny 200
Gina 300
Doug 400
Database 2
Eric 18
Jenny 20
Gina 34
Doug 55
View 5 Replies
View Related
Apr 3, 2009
I have very little experience with Visual Basic and seem to be having trouble with what I think should be a fairly simple matter.
I want to add a control to a userform that allows the user to select a range of entries to be deleted.
The user can’t directly modify the spreadsheet as it is protected. The only way for them to change it is via the userform.
The way I want it to work is when the control is selected a form appears in which the first and last rows of information to be deleted are specified.
I don’t want to delete the whole row, just the first 7 columns of the specified row.
Here is the Code that I have so far:
View 8 Replies
View Related
May 11, 2009
I am making planning & status board for each project(yard). But in my 1st Stage I am having a problem for creation of Userform & List Box for my Display Sheet.
Problem-1) I want to create userform which can Add or Delete my MasterData.
Problem-2) I want to display & change Block Status of Yard in List View. Yard No will be selected using combo box.
List View Should allow addition & Deletion of record.
Note: I am a bit new user for VBA but can copy codes from sample file to use in the files.
View 8 Replies
View Related
Oct 24, 2011
Any way to use a search form I've created to delete data from the original sheet. What I'm doing here is using advanced filter to copy data from the original database onto a temporary sheet to display in this list box. I've gotten almost everything to work properly, but since this is populated by advanced filter, I don't really even know where to start on my delete button.
Code:
Private Sub Search()
Dim Criteria As Range
Dim SearchRange As Range
Dim SearchResults As Range
Set Criteria = Range("Values!Criteria")
[Code] ......
So I was thinking something like this:
Code:
Private Sub cmdDelete_Click()
lstResults.Value.delete
End Sub
But I know this won't work.
View 1 Replies
View Related
Sep 4, 2006
Some time ago (not sure how long ago) I created a splash screen that comes up when I first load a particular workbook. There was only one worksheet in the workbook and at that time the data in the worksheet was not so relevant and hardly ever used. That workbook name is "Employees" and the worksheet name is "EmpData".
Subsequently, the worksheet ("EmpData") in the workbook "Employees" has became relevant to a new workbook named "Payroll" I created. This workbook is used all the time. It had four different active worksheets.
I realized last week that the data in "EmpData" was very relevant to the work in the "Payroll" workbook so I copied "EmpData" worksheet in it's entirety to the "Payroll" workbook as a fifth worksheet using the same name as before, "EmpData". Now each time I open the "payroll" workbook the splash screen shows up and hangs around for several seconds or longer. It has become quite irritating and I want to delete it.
View 3 Replies
View Related
May 7, 2006
example of a database user form that will allow me to list records in a sheet as well as search for records in a sheet. I know excel has a built in feature for this but it is menu driven and I need something that is button driven and will allow me to resize the form layout. I was not able to figure out how to do that with the built in form.
View 7 Replies
View Related
Apr 21, 2006
i have been trying to hide the userform from the workbook open event with no luck
Private Sub Workbook_Open()
ufmTheEstimator.Show
Dim Worksheet As Excel.Worksheet
If Me.Worksheets("Main Roof"). Name = True Then
ufmTheEstimator.Hide
End If
End Sub
View 4 Replies
View Related
Jan 7, 2010
I have a worksheet in whichs Column A Cells , there is corresponding string content in Col. Z. Some cells of column Z contain of many lines (up to 100 line) which i want to reduce to one. I want to select one line through double clicking in the listbox of the userform and all other lines should be deleted and only the clicked one should remain. Code should then jump to the next non empty Z cell.
Columns B, C, D, E, F, G and H should also be shown in the userform and they should be live editable. I have attached and example file with userform and example data.
View 10 Replies
View Related
May 8, 2012
I have a userform that has a combobox in it that also has an OK button and a Cancel Button. Need getting the combobox to pull in the correct list? The data for this list will be in cells A2 through A16. But not all 15 lines will always have data in them so I'd like to only show the ones with data. Then next issue i have is I would like the OK button on this userform to actually erase the data the user has clikced on in the combobox. It's a list of kids that the userform is asking which one needs to be deleted. So it might be the kid in cell A9. so when the user clicks on that kid in the combobox form a9 and hits ok I'd like to have all the kids below A9 move up one row.
Windows XP
excel 2003
View 6 Replies
View Related
Jan 24, 2014
I have a spreadsheet on sheet 1 with a list of customers and their information. So on column A I have the customer number (i.e. k968, e37, p528,...), on column B i have the customer's name, on column C the street's name, on Column D the house number, on column E the zip code and finally the city on column F.
Right now there are around 600 customers in this list.
I have made a userform with a combobox in which I want to select an existing customer (pulled from the spreadsheet). On the same userform I have textboxes (customer number, name, street, number, zip, city). When I select a customer in the combobox, I want this customer's info to show up in the textboxes. I want to be able to change the info and hit Next to store the changes in the spreadsheet. When I do not select a customer from the combobox, I want to add new info in the textboxes and hit Next to store this info as a new customer. The userform also has a delete button. Then I select a customer in the combobox, this customer (and it's info) should be deleted from the spreadsheet when i hit Delete. So the spreadsheet is variable in length.
View 5 Replies
View Related
Nov 26, 2013
I wondering if it's possible to create a code to have a popup where the user can enter a date in mm/dd/yyyy format and then all rows containing that date will be deleted.
View 9 Replies
View Related
Jul 16, 2012
I have created a userform and a command button to bring up the user form but when I click on the command button and the user form pops up I am not able to enter any data, the entire page freezes
This is the code
Private Sub CommandButtoncancel_Click()
unloadme
End Sub
Private Sub CommandButtonOK_Click()
With Workbooks("RETS results version 2.xlsm")
[Code] ......
View 1 Replies
View Related
Jun 15, 2009
This is weird - if you delete a sheet that contained a control then
a. showing a modeless userform resluts in a userofrm that goes invisible at subroutine End
b. public variables lose their value
These things do not happen if the sheet did not contain a control. Attached is an example file - put the inputfile.xls in your default file location (or add a path in the code) then open the ProblemDemo.xls and run the main macro to see it fal - isthis another Excelbug I've found?
View 9 Replies
View Related