Modules & VBA :: Deleting Records Based On Month

Jul 26, 2013

I want to write an sql or vba code to delete records based on the month...For example I have a field called date which contains a date and I want to delete all Dates that are In April

Ive tried
Delete from LinkTable Where month(Date) = 'April'
Still Nothing

View Replies


ADVERTISEMENT

Modules & VBA :: Export Records By Date Based On Input Month

Nov 10, 2014

I am trying to export records to excel that are in a given month based on an input month. The user would select the month with the records desired and click the button to export them to excel. The attached zip file has an image of the database and the code behind the button is:

Code:
Private Sub Command33_Click()
DoCmd.OpenReport "HLA_TAT", , , "Len(Exception & '') > 0 AND Receive_Date > #" & Forms!HLA_TAT.Date & "#"
End Sub

[CODE] can not access referenced form HLA_TAT [?CODE]

View 11 Replies View Related

Deleting Subform Records Based On Checkbox

Jun 21, 2005

I have a form with a subform inside of it. On the subform I have created a field for a check box. I wish for the user to be able to click 1 or more check boxes in the subform and then click a delete button that removes all selected entries.

I have this code from a seperate post regarding this problem, but am not sure how to edit it to reflect what I need.

Sub DeleteRecordButton_Click()

'Delete the selected record
dim strSQL as String
strSQL = "DELETE * FROM mytable WHERE mytblID = " & Me![mySubForm].Form![mytblID]

DoCmd.RunSQL strSQL

MsgBox("Confirmed")

End Sub


Thank you!

View 1 Replies View Related

Deleting Records Based On A Field Content?

Nov 16, 2004

Hi all!

I'm rapidly beginning to get a little confused... I'm trying to mass-delete records based on the content of a field.

I want to run either a query or a button on a form (or anything, for that matter) that will delete any records when there is an X in the N_Disp field.

Any ideas?

Thanks,

Barry

View 3 Replies View Related

Queries :: Deleting Records Based On Selections From Another Table

Apr 1, 2013

I am trying to create a Delete query.

I am trying to delete a specific part from multiple BOMs in my database.

I have a table of the BOMs that I want to look in. I called this table PartTable. I also linked my database table SYSADM.REQUIREMENT which contains all the requirement parts for all of our BOMs.

So I am wanting to delete only part number 123XX from each of the BOMs in my PartTable.

I am able to select the records with:

Code:
SELECT SYSADM_REQUIREMENT.*
FROM SYSADM_REQUIREMENT INNER JOIN PartTable ON SYSADM_REQUIREMENT.WORKORDER_BASE_ID = PartTable.PART_ID
WHERE (((SYSADM_REQUIREMENT.WORKORDER_TYPE)="M") AND ((SYSADM_REQUIREMENT.WORKORDER_BASE_ID)=[PartTable].[PART_ID]) AND ((SYSADM_REQUIREMENT.WORKORDER_LOT_ID)="0") AND ((SYSADM_REQUIREMENT.PART_ID)="123XX"));

Now how do I delete these same records.

I am getting error saying I have to select a table to delete from....

View 11 Replies View Related

Modules & VBA :: Deleting File Based On Date

Feb 12, 2014

So I currently have a module which automatically backs up my database to a separate file everyday on open of my database.

If is it possible to create a function which will allow me to delete these backups after a certain amount of days (eg 30 days). They all have different file names based on the time that the backup was created but have the same extension of "*.accdb". I ask because it stores EVERY backup so the storage space required will soon build up unless manually deleting the files which is not what my client will want,

I have tried using the "Kill(pathname)" function but have had no luck yet!

If possible, I would like this to be done automatically either on open or on close of my database.

Would this be done with a module?

View 1 Replies View Related

Modules & VBA :: Deleting Records Within Certain Timeframe?

Jun 19, 2014

I would like to make it so that if that last record inputted with the same ID was inputted within the past 5 minutes then it will not input the new record into the database. Im not sure how to code that time frame, but more importantly how to tell access to not do anything if the criteria does not match.

here is my code:

Code:
Dim LrecID As Variant
Dim LrecInOUT As Variant
Dim LrecDate As Variant
Dim Lname As String
LrecID = DLast("EmployeeID", "QryEmployeeClockIn", "EmployeeID=" & Me.EmployeeID)

[Code] ...

' I was thinking something like this:

' If Me.EmployeeID = LrecID And LrecInOUT = 0 and LrecDate is not within 5 minutes ago Then
' InOut.Value = -1
TimeStamp = Now()
DoCmd.GoToRecord acForm, "FrmEmployeeClockIn",

[Code] ....

View 3 Replies View Related

Modules & VBA :: Subtotal Based On Month Not Day?

Oct 4, 2013

I have created some subtotals in some columns of data which for example are the dates, names, and amounts of invoices.

The code I used is:

Range(Range("C1"), Range("C1").End(xlDown)).Select
Selection.CurrentRegion.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3)

This is working of sorts but it is giving me subtotals based on the day in the date column. How can I change this to group by the month?

View 10 Replies View Related

Modules & VBA :: Calculate Next Service Month Based On Dates

Jan 16, 2015

I've been trying to solve this problem for the past month and at the verge of destroying my PC! I've trawled through numerous web sites but just cant seem to figure this one out.I'm trying to get access to tell me what the next service moth is based on the start date, end date, and the frequency of service.

For example:

Start date: 01/01/2014
End date: 31/12/2015

service frequency: Every 4 months

Using the above information the service months are:
1 - April 2014
2 - August 2014
3 - December 2014
4 - April 2015
5 - August 2015
6 - December 2015

View 6 Replies View Related

Modules & VBA :: Button To Export All Records In Database In Specific Month

Nov 6, 2014

I am trying to create a button on an access form that will prompt the user to enter a search month and then export to excel all records in that database that match that month.

So, if the user prompt "what month" is October, then THE 30 records in the field [receivedate] that are in october (10/XX/XXXX) are exported to excel.

View 7 Replies View Related

Deleting All Related Sub Records When Deleting The "main" Record.

Apr 12, 2008

I have two tables.

1. Persons (list of persons)
2. Job history (list of jobs)

each person have their own job history. all these jobs are stored in the job history table. when i delete a person i would like the job history for this person deleted as well. each job stored in the job table have a field with person name, so that it is linked to this person.

how can i do this? vba or simple properties options?

- Roy

View 1 Replies View Related

Modules & VBA :: Delete Records From A Table Based On Records In Another

Feb 7, 2014

I have a table InvPrice and Updated Pricing

Need to delete all records from InvPrice that Match UpdatedPricing

InvPrice.StockCode = UpdatedPricing.StockCode
InvPrice.PriceCode = UpdatedPricing.StockCode

I have tried something like this...

Dim dbs As DAO.Database, sql As String, rCount As Integer
Set dbs = CurrentDb
sql = "DELETE * dbo_InvPrice Inner Join (dbo_InvPrice Inner Join UpdatedPricing on dbo_InvPrice.StockCode = UpdatedPricing.StockCode ) ON on dbo_INvPrice.PriceCode = UpdatedPricing.PriceCode "
dbs.Execute sql, dbFailOnError

View 14 Replies View Related

Deleting Duplicate Values Based On 2 Fields

Jan 3, 2006

Hi guys,

I have a question I've been trying to figure out with no luck. I have 2 fields, companyname and zip, these 2 fields may have duplicate values or they may be uniquei.e.

companyname zip
billybobs 68135
dilberts 68137
billybobs 68135

what I need to do is delete all of the duplicate records where both companyname and zip match. Is there a way I can do that with a query?

Any help is greatly appreciated

Thanks

James

View 14 Replies View Related

Modules & VBA :: Renaming Files Based On Records In A Table

Oct 16, 2014

Code to rename photos (Access 2010). The new name (full path) is listed on a table (although I would love to accomplish the task from the list query that I later used to generate the table). There is one field in the table (or query) called OldPath and one field called NewPath. The table name is RenPaths. Both paths are located in the same drive. I want to rename the file in a new folder. I created the new folder which is contained in the NewPath.

I was trying to accomplish this using the Name function

Name OldPath as NewPath

Here is the full code:

Private Sub Command0_Click()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim OldPath As String
Dim NewPath As String
OldPath = "Select OldPath From RenPaths"

[Code] ....

Here is an example of the paths in my table:

Old Path is - C:UserskcrespoDocumentsFulcrum to MACPFulcrum_Export_a97dee97-ba92-455e-9d5c-3b35617ad357SAA Inspection Form367e14e0-439b-4a50-99e1-9154bcc9e3f7.jpg

New Path is - C:UserskcrespoDocumentsFulcrum to MACPFulcrum_Export_a97dee97-ba92-455e-9d5c-3b35617ad357SAA Inspection FormimageswwMH51856_A3f7.jpg

Im getting an error: Run time error '53': File not found

I checked the OldPath and everything is correct so if the code is working correctly it should have found the file.

View 3 Replies View Related

Modules & VBA :: Updating Records Based On File Location

Mar 3, 2015

I have created a database that tracks the locations of all the faxes we receive in a day. We have a dedicated employee that enters them into the database as well as who they are assigned to and other pertinent information. At the end of the day, I monitor the network folders where the faxes are saved to change the status of the fax in the database to done, still needs processing, or awaiting approval. Is there any way that I could set up some VBA that would automatically update the status column for the record based on the location of the file? The file name is recorded in the database so then if it sees that that file is in the end folder it could automatically update the status to finished.

The response I got on another forum is as follows:

-The impression I'm getting is that you've got a database of information over here.
-And it lists the file name, but not location.
-And then you have a physical folder structure with the fax files in it.
-And there are folders for done, awaiting approval, or processing.
-So what you're looking for is something to read those folders and update the status column based on which folder it is in?
-So at the start of the day we have:

New
-Fax1.tiff
-Fax2.tiff
-Fax3.tiff
-Fax4.tiff
Finished
-
In progress
-

And at the end of the day the folders look like this:
New
-Fax1.tiff
Finished
-Fax3.tiff
-Fax4.tiff
In progress
-Fax2.tiff

And you want your code to browse those folders, and update the status of each filename based on it's folder?If the filenames are unique, you can just use VBA to open the folder, create an array of the files and then set the status. Create two separate functions, one for in progress, one for completed and call them one after the other. There'd be no need to check the current status, but you could store the wrong status if a file is duplicated, or a filename repeated.

View 3 Replies View Related

General :: Deleting Record Based On Double Criteria

Nov 30, 2012

I am wanting to delete a record based on 2 criteria. ive had a look on the net and it looked so simple. I tried

PHP Code:

CurrentDb.Execute _    "DELETE FROM tblRecommendedProducts " & _    "WHERE ClientDetailsID = " & [Forms]![frmClientSale]![ClientDetailsID] And "WHERE ItemsID = " & [Forms]![frmClientSale-Retail]![ItemsID], dbFailOnError 

View 14 Replies View Related

Modules & VBA :: Update Record Based On Related Records Completed

Dec 4, 2014

I have 2 tables, one is like a main table, containing all of the main data, such as a Job Number, Customer, Quantity, etc. I have a second, related, table that acts a breakdown of information. There may be several related records to one main record, it entirely depends on the nature of the job.

What I'd like to do is run a function that looks at a main record, checks if all the related records COMPLETED field is ticked and then tick a field in the main record. I only want it to do this for records where all of the related records are COMPLETED.

View 3 Replies View Related

Modules & VBA :: Creating Text Boxes Based On Available Records On A Table

Aug 2, 2013

Table name: Items
Field: ItemName
Form name: Frmpayments

when I open the above form, it should create texts boxes on "frmpayments" based on how many data available in "Items" table under "Itemname" field. It'll be even better, if it can put those item's name in each text box it creates.

View 1 Replies View Related

Form Based On Queries - Deleting Field From Main Table

Mar 28, 2014

In my Access2000 db, I have a table, on which many different queries are based. Many forms are based on those queries. I want to delete some redundant fields from the table. I tried deleting one, but I found I could no longer open any of the associated queries and forms. Is there a simple way to delete table fields so that it doesn't stop me from opening associated queries and forms? (There are hundreds of them, and I have a lot of table fields that I want to delete).

View 1 Replies View Related

Modules & VBA :: Update Table Based On List Box Multi Selected Records

Nov 24, 2014

I have database with an userform called AssignWP, combobox called WPDevBy, listbox called List352 (Multi select) and table called Justified.I am trying to update one field WPDevelopedBy of the table as combobox value based on list box multi selected records.

View 2 Replies View Related

Modules & VBA :: Count Number Of Unique Records Based On Range Of Date

Jan 19, 2015

Code:
' count records in query
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Dim beginDatum As String
Dim eindDatum As String
Set db = CurrentDb

[code]....

View 4 Replies View Related

Deleting Records

Aug 4, 2005

I have two tables (same data but slightly different attribute structure) with a one-to-one relationship (the join field is "ID"). There are 69 matching records in these tables. How can I delete these matching records from table A, while leaving them alone in table B?

I'm confused because I brought both tables into a select query, created a join from ID to ID (within in the query's design view), and then added all fields from table A to the query. I then ran the select query and saw the 69 records from table A in the query's data view that I wanted to delete, highlighted all records and clicked delete. However, this action deleted the 69 matching records from TABLE B, not Table A!!! How is this possible? What should I do instead? Thanks.

View 3 Replies View Related

Deleting Records

Nov 11, 2005

A strange request but I hope someone can help with this one

I have a table (tbl_Econ) where I have to delete a specified number of records from a table. It does not matter which records as long as I delete the exact number

e.g On a form text box I enter the number or records to be deleted (e.g.6000).

The table (tbl_Econ) has 8000 records, so I have to delete 6000 records. I need to be able to do this automatically :eek:

View 1 Replies View Related

Deleting Records

Feb 1, 2006

How can I go about deleting records fully? So that there autonumber, etc can be used again without access moaning.

Thanks :D

View 1 Replies View Related

Deleting Records

Mar 14, 2006

I have a query (Query1) which returns results In one field recordID.

How do I delete records in a table where the RecordID is in the list Query1.recordID?

Thanks

View 4 Replies View Related

Deleting Records

Jan 25, 2008

Hi,

how would i go about deleting a set of records? i can get a list of records together in a query taken from 4 tables and would need to, if necessary, delete a single line. not all information needs to be deleted from all 4 tables though? the info to be deleted would only be deleted from 1 or 2 tables being the last 2 in the relationship.

i guessed it might be an append query but im not too familiar with them.

any chance of a possible suggestion?

many thanks,

NS

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved