ADO Delete Database Records
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
ADVERTISEMENT
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 11, 2008
I am a building a database where each row represents a record. Each record has a unique identifier number.
In worksheet "Record Search and Amend", I have recorded a macro to look up the data.
The problem is once the record is retrieved I need to be able to amend the record and save it back into the database in the right row. This could be another button to initiate this action.
View 14 Replies
View Related
Nov 7, 2011
I am using ADO to retrieve records from an MS ACCESS DB in Excel. All my queries work fine but I am having problems with subqueries. My subqueries work fine in ACCESS but when I execute them via ADO I get the following error message:'"The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect".
with the correct syntax. Alternatively I was thinking of creating a view in ACCESS but that seems not possible.
PHP Code:
Sub retrieve_loan_details()
Dim Provider As String
Dim Source As String
Dim sConn As String
Dim sSql As String
Dim rep_per As Date
[Code]...
View 6 Replies
View Related
Apr 30, 2013
This is my invoice. I want to be able to create a database record of every transaction. In the end I want to be able to export this data into Access, but it needs to be in sequential rows and columns. I want to be able to list the cells on Sheet 1 that have Data in them in the configuration on Sheet 2 that I have listed. What I need to keep in mind is that someone might have 1 item in a transaction and others might have 5. So I need the ShopID and Customer information to appear in front of every item listed in rows 20-27.
A
B
C
D
E
F
G
H
1
ShopID Data
[Code]....
View 1 Replies
View Related
May 8, 2008
I am having trouble with my excel spreadsheet, which I am using in effect as a database. I do realise that Access or something would be better but lets just say I'm forced to use this method.
Basically, i have a table of records storing names and addresses, identifiable by a reference number, "ID" eg. record number 001,002 etc.
I need to be able to display a given ID number's record on a different sheet in the same document. I have already achieved this by using a macro and some VLOOKUP's.
So, in my second sheet, I have person 001 for example and their name, address, post code, telephone number is displayed each in its own seperate cell.
What I need to do now, is create a macro of some sort that will allow me to save this record back over the original record in the table (in sheet 1).
View 3 Replies
View Related
Aug 30, 2013
Specifically, I have customer sales data from my web site that contains order numbers and sales data. From Google analytics, I have transaction information that also contains the order number. The data element that is common to both is order number. I can't just paste columns from one file into the other because the records listed in rows may not match up.
I don't want to have to copy and paste data from one file to another for each record manually since I have thousands of records. Is there a way to merge the two files together automatically by having Excel "understand" that it should pair the two files together using the order number to create a row that contains data from both files?
View 1 Replies
View Related
May 28, 2014
I am using Access as a backend and Excel as a frontend. I want to count total number of records for todays where Time<13:01
Modify the following code accordingly?
[Code] .....
View 1 Replies
View Related
Jan 20, 2014
I am new to to VB Scripting, filter the records. In the attached file there are multiple records which needs to be filtered. Once all the records are filtered, i want to delete the entire row of that record(s). I want to filter column 'F' with the values mentioned in Sheet2. I tried recording a macro, but it is not allowing me to do so as the macro has some limitations. The search and delete row loop The main purpose is to delete the row of the value, if not found, move on to next value in Sheet2.
View 4 Replies
View Related
May 23, 2014
I have a large (300K+ records) database with a sizeable amount of duplicate records. I want to delete the duplicates but this is not a matter of simply Remove Duplicates; I need to evaluate them before I do.
I am wondering what functions would:
1) select the specific record in a set of duplicates that makes a determination of a status
2) once the status has been determined for the set, delete all other records
Fields in my database:
ACCIDENT NUM (ID field, in text or General format)
DUP (for Duplicate, indicated by a character, for now its a "?")
OCC_KILLED (in Number format)
OCC_INJURED (in Number format)
SEVERITY (in text format)
Here are some scenarios:
ACC dup K I
12345 ? 0 0
12345 ? 1 2
Or:
ACC dup K I
123456 ? 0 1
123456 ? 1 0
Or:
ACC dup K I
1234567 ? 0 0
1234567 ? 0 2
1234567 ? 0 0
This is the formula for indicating if there are Duplicate records in the larger dataset:
=IF(OR(A2=A3,A2=A1),"?","")
I need to determine the Severity of the accident based on this:
If OCC_KILLED > 0 then SEVERITY = F (for Fatal)
IF OCC_INJURED > 0 and > OCC_KILLED then SEVERITY = I (for Injury)
IF OCC_KILLED and OCC_INJURED >= 0 then SEVERITY = F
IF OCC_KILLED and OCC_INJURED = 0 then SEVERITY = PDO (for Property Damage Only)
I have a code already in place for how to create the value for Severity but it DOES NOT account for duplicate records:
(in SEVERITY field):
=IF(A1<>0, "F",IF(B1<>0,"I","PDO")
sampleset.xls is a sample ot the database.
View 10 Replies
View Related
Jul 15, 2009
I have a spreadsheet with a column of records (text ) from B1:B4000. I would like to delete the entire row of the duplicate record. Overall data set range is (A1:I4000). This spreadsheet may contain more than 1 duplicate record. Is there in easy fix?
View 12 Replies
View Related
Nov 22, 2009
I'm having trouble getting this piece of macro to work. I want to delete duplicate Id records in (Cell B12 : B124), but only those with "No" in the (Cell Z12 : Z124) will be deleted.
Table
B12 Z12
-------------
E1 Yes
E2 Yes
E3 Yes
E4 Yes
E1 No
E2 No
E3 No
E4 No
Expected results:
E1 Yes
E2 Yes
E3 Yes
E4 Yes
View 13 Replies
View Related
Jun 29, 2009
I have some data that looks like this.
No. Date
1519
1519 06/17/2003
1601
1652 06/30/2005
1652
1705
1705
What I would like to do is delete all numbers including those with duplicates that have a date of 2004 or sooner. In otherwords, anything from 12/31/2003 and later I want to keep, but anything from 01/01/2004 until the present.
View 9 Replies
View Related
Oct 31, 2008
I d like to find a method with which I can delete records from E starting from E2 that have 0 or even blanks with a macro.
View 9 Replies
View Related
Mar 23, 2012
how to automatically complete with Excel the following task:
1. I have two email databases in Excel: a master database and opt-out database.
2. I need to remove from the Master database emails of opted-out people.
3. Since the databases are large, I'd like to use a relevant Excel function to do that automatically.:
In the master list (column B) I have all the emails from the Master list. I have copied in the column C of the Master list the emails of all who opted-out. I need to remove opted out emails (listed in column C) from the master email list (column B).
View 1 Replies
View Related
Jul 18, 2012
I have a spreadsheet titled "PMIX" In Columns A:F Column F has Week Ending date. Each week, I need to update this, i.e. delete the data from two weeks ago and then add the new weeks data. What I am thinking is I enter a Week Ending Date in H1, then I would like VBA to delete all rows where it has the data in H1. I am hoping for a delete function as opposed to a clear so I can shift all the rows up.
View 3 Replies
View Related
Oct 31, 2008
I d like to find a method with which I can delete records from E starting from E2 that have 0 or even blanks with a macro.
View 9 Replies
View Related
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
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
View Related
Mar 1, 2009
1. Is there a way to delete all records below a variable row which I select highlighted ?
2. I have a spread sheet which is located in the folder xl start. How can i find this file to delete it>
View 5 Replies
View Related
Jun 1, 2009
I'd like to do is click the delete button and when clicked, it will search for matching records in column A & B and if they match... I'm thinking the code for that is <> but I'm not sure, then delete that record, and shift the cells up. Do this until the search results are empty below the delete button. Like I said, it's probably more understandable to look at the workbook.
View 5 Replies
View Related
Oct 3, 2013
Creating a macro. Need to delete records in column D from the first blank cell. 1st blank cell variable.
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 10, 2014
I have a range of columns i.e. 23 columns (i.e. B through X). Someone can write records in these columns (starting from B21).
Duplicates are considered the rows with similar data in columns 3 and 11. I know about the removeduplicate method and works really well but i want the duplicates not to be removed. Instead another column shall be checked for date of entry (user will entry date in format dd/mm/yyyy). The newest entry will change the value of the cell in column 4 (islatest column)to TRUE while all other records will be FALSE. This will work with the filtering of data on a pivot table on another worksheet.
View 7 Replies
View Related
Apr 25, 2014
Book1 and Book2 are workbooks that I have modified in order to protect private information.
Book1 will have 11,000 records (my example Book1 has only 100). I need to rearrange Book1 such that it looks like Book2. Book2 has 20 complete records from Book1 combined into one single row, and my example Book2 has populated 3 rows only (3 rows x 20 records, making 60 records now appear on 3 rows only).
Macro for getting Book1 to Book2? 11,000 records in Book1 will take a lot of hours to transform into Book2 unless a macro can do the job for me.
Book1.xls
Book2.xls
View 5 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
Jun 6, 2013
I have a dataset with 5 columns. i want to identify the the max users in each zip code and the corresponding ID for it. For e.g. for zip 01105, max users are 1380 for ID 010840. I want my final data to have just these 3 values.
I tried the pivot table but it hides the ID corresponding to the MAX value.
ID Zip CityState Users
01084001105SpringfieldMA1380
01012001105SpringfieldMA1102
01003001105SpringfieldMA518
01145001105SpringfieldMA27
01384001105SpringfieldMA3
01084001107SpringfieldMA629
[code].....
View 2 Replies
View Related
Jun 17, 2014
I am looking for a formula to give me the top10 records from a range.
Please take a look : Top_10.xlsx
View 6 Replies
View Related