Modules & VBA :: How To Selectively Clear Cells In A Column

Oct 7, 2013

I have had to copy a column of dates to a new column to extract the month and be able to make subtotals based on each month.Now I am trying to tidy up the column by removing all the cells containing the month and leave behind the subtotals.

I have got a little way there using:

lastrow2 = Range("A1").End(xlDown).Row
With Range("A1:A" & lastrow2)
Set RngFnd = .Find(Total).
Set rngDelete = .ColumnDifferences(Comparison:=RngFnd)
rngDelete.ClearContents

But it only clears the cells down to the first subtotal so how can I get this carry on?

Alternatively I could use code to find the subtotal, and then cut and paste it into the next column over if that would be easier?

View Replies


ADVERTISEMENT

Modules & VBA :: CMD Button To Clear A Table Column

Mar 26, 2015

I'm currently making an Experience Statement for my company. In one of the forms I've created I an Industry sort that is weighted and connected to a table so that it'll show a report based on the numbers provided IE. 1-5 One being shown first and a blank statement not showing on the report at all.

I have the report function working correctly the only thing I would like is a cmd button that clears sort table of numbers so that it doesn't show anything and can start fresh. What VBA code shall I use?

I was thinking something along the lines of this, but it's not working.

Dim s as String
s = "UPDATE All_Projects_Sort_Table SET Industry Sort = Null;"
CurrentDb.Execute s
Requery

Attached are some images ...

View 2 Replies View Related

General :: Changing Column Colour In List Box - Alignment For Cells Data

Jan 7, 2014

How can change column color in list box and also how to make alignment left or right for cells data.

View 1 Replies View Related

Clear Data In A Complete Yes/no Column

Aug 12, 2006

K,

I'm new here and I have a question:
In my db I have a yes/no tick, now I want to create a button that clears out all the ticks in that specific column, possible?
To clarify:
I have an address db with an gift table (tbl_gift) and a yes/no parameter for, lets say, 'did they gave me a present with christmas?' (col_gift).
Naturally I want to clear their records before next christmas, now instead of going through all the records and remove the tick, is there a fast-one-button-click solution for this?

Thanks in advance!
Paul
(btw: sorry for my English, I'm Dutch and damn proud of it!)

View 3 Replies View Related

Fill Blank Cells With Appropriate Data From Preceeding Cells

Jun 28, 2005

I have table1:

Name, Date, Points
Peter, 1.8.2005, 100
________2.8.2005, 200
Paul, 1.8.2005, 100
________4.8.2005, 300

etc. and I need to fill the blanks with Peter, Peter... , Paul, Paul, ... etc. so, that I can later take it as a group ID and work with the data.

Preferably with SELECT query, but insert or update is also possible.

View 3 Replies View Related

Modules & VBA :: Sum Row Cells Value?

Sep 17, 2013

I'I need to randomly input values into row cells and when press enter key, it calculates the total value and show in another sheet. Example, in sheet1, I input random values in A1,C1,D1,Z1 and when I press enter key, it calculates the total value and appear in the first row cell, A1, of sheet2. All by VBA coding.

View 1 Replies View Related

Modules & VBA :: Formatting Cells In Excel Spreadsheet

Aug 18, 2014

I am using Access 2010 . I need to format cells inside the Excel spreadsheet

Here is my code:

Dim ApXL As Object
Dim xlWBk As Object
Dim xlWSh As Object
Dim intColumn As Long

Set ApXL = CreateObject("Excel.Application")

[Code] .....

The code "With xlWSh.Selection" returns a run-time error 438 - Object does not support this property or method

When coding, when entering a "bang" ("."), Access normally returns the next piece of code. The code above does not! How to I correct this?

I do have a reference to Microsoft Excel 14.0 Object library....

View 3 Replies View Related

Modules & VBA :: Export And Import Particular Cells From Excel Template

Jul 20, 2015

I have a few problems and I want them to be able to be done from switchboard:

1. Is there a way for me to export a particular report (after selecting it) to a closed excel template, that is formatted? It would open the excel template (that has a logo and column headings), export data to below the column headings, then save the file with a unique name?

2. Also, a way to import data from an excel file, after allowing the user to select file? Only data below the column headings mentioned above. Same data will be appended to existing table.

View 1 Replies View Related

Modules & VBA :: Copy Query Info To Specific Excel Cells

Mar 7, 2014

I have spent the day using Access 2010 and attempting to move information from a parameterized query into specific cells in an excel template. It runs smoothly until I attempt to reference the query at which point I run into th error "Too few parameters. Expected 1." Currently my reference code looks like this:

Dim T As Recordset
Set T = CurrentDb.OpenRecordset("SELECT [8D Data].ID, [8D Data].[Customer Closed], [8D Data].[Days Open], " & _
"[8D Data].[Open Date] , [8D Data].[QN #], [8D Data].[Last Report Date], " & _
"Leaders.[Leader Name] , Leaders.[Leader Title], Leaders.[Leader Phone #], " & _
"Leaders.[Leader Email], [8D Data].[Part Description], [8D Data].[Customer P/N], " & _
"[8D Data].Customer , [8D Data].[Vehicle Year], [8D Data].[Problem Description]" & _
"FROM [8D Data] INNER JOIN Leaders ON ([8D Data].Lead = Leaders.ID)" & _
"WHERE ((([8D Data].ID)=[Enter QCR #]));")

View 4 Replies View Related

Modules & VBA :: Looping Through Files - Import Specified Cells Into A Temp Table

Jul 22, 2015

I am trying to write a VBA Module that will look in a directory for Excel files with a specific file prefix, and then import specified cells into a temp table. Once it processes the first file, it copies the file to another folder, and then kills the file. However, when I run my current code, it goes through the loop the first time, but fails on the second attempt, because it is still looking for the first file it came across even though it has been moved. The code is pasted below:

Sub Count()

Dim xlwrksht As Excel.Worksheet
Dim xlWrkBk As Excel.Workbook
Dim nIndex As Integer
Dim strMvPath As String
Dim mvPath As String
Dim strFile As String

[Code] ....

View 6 Replies View Related

Modules & VBA :: Identifying Highlighted Or Bold Cells To Import Into Access

Jun 12, 2014

I receive a bunch of excel files with items to be added to a database. some of the items are to be added as new, some to be deleted and others to be modified.

I identify the action (add/delete/modify) by looking at a column in the excel file e.g. column A.

At this point I am fine with the add/delete because I can filter the data or bring all the files to a temporary table in an Access database via vba script and then running queries to do the rest.

My issue is that the spreadsheets have a lot of columns and for the modifications what they do is use the same file for instance, make changes on the cells (any cell) that need modification and then highlight, bold or underline only the items that need modification and ignore the rest of the file (a tedious process since I have to then open each file and manually modify the database).

View 1 Replies View Related

Reports :: Extract Selectively From Different Tables

Sep 7, 2014

I'm designing a database for a laboratory. There are many tables that will contain test results. They all have in common a field called ID( primary key) linked by a one to one relationship because one patient has reports in different tables. The ID is unique to each patient. For the Reports, i hit the rocks... How can i structure a report that can extract a patient's records from the different tables where they appear in the database?

View 8 Replies View Related

Modules & VBA :: Store Data From Access Table To Excel Sheet In Corresponding Cells

Jan 28, 2015

I am writing the following code that will first of all display column headers dynamically using "Headers" field data from Access table and then find out the sum(volume) using column header and first column values. The following code works fine to display headers dynamically in Excelsheet from Access table but doesn't display sum(volume) in all the corresponding cells. As I can't attach the Access table so I have stored data from Access table to sheet named "Access Data" as attached. The sheet2 named "Report" should populate total volume .

Code:
Public Function Inputdata()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim r As Long
Dim i As Integer

[code]...

View 2 Replies View Related

Modules & VBA :: Filling Excel Template Cells / Save Then Send On Outlook

Jul 13, 2013

I have the code below which takes information from a form on access and sends it over to the correct place on an excel spreadsheet template. This works fine but I then need it to save and send on outlook.

The issue I am having is that the saved document is not attaching to the e-mail. The subject etc all work fine but the excel spreadsheet just doesn't attach. When I go into the folder I have specified for the document to be saved in it isn't there either. :0(

The code for the e-mail "callmail" function works perfectly for word documents but I don't know if it is different for an excel file.

Code:

Private Sub Command154_Click()
On Error Resume Next
Dim appExcel As Excel.Application
Dim wbook As Excel.Workbook
Dim wsheet As Excel.Worksheet
Set appExcel = New Excel.Application

[Code] .....

View 4 Replies View Related

Forms :: Make Fields Selectively Updatable

Nov 6, 2014

I have a form consisting of a list box and some fields belonging to a single record. When the user highlights a row in the list box then the fields show the details of that record. Now the whole process is Read only. But I wish to put a toggle switch on the form so that the detail fields of the record become updateable. I have tried the following constructs but I could not make those fields updateable.

Code:
Me.AllowEdits = True
Me.DataEntry = True
Me.fld1.Enabled = True
Me.fld2.Locked = True

View 12 Replies View Related

Modules & VBA :: Disable And Clear Text Box?

May 23, 2015

using Ms access 2010.I have two text boxes where depending on what is entered on the first the 2nd disabled.that works fine but if I make a mistake and enters a value on the 2nd while it is enabled and return back to the first and enters a value which disable the 2nd, it disable it ok but keeps the value and even save it to the table.

Private Sub q300_AfterUpdate()
If Me.q300 = "1" Then
Me.q300_1.Text = ""
Me.q300_1.Enabled = False
Me.q301.SetFocus
Else
Me.q300_1.Enabled = True
End If
End Sub

View 9 Replies View Related

Modules & VBA :: Clear Field On Error

Nov 1, 2013

I have got a form with a couple of dlookups on it, when they return an error it pops the debug message up and if there is a value in the field already it just leaves that value there.

How can I suppress the message and clear the field and move on to the next line of code?

View 6 Replies View Related

Forms :: Selectively Update One Value In A Table By Lowest Date

Mar 17, 2014

I have a relatively complex update that I need to perform on a table from a form. I have a system that has "games" and "game copies". The game is simply a name of a particular game and the copy is something that has a stock number but a foreign key of the game catalogue number. This means I have several catalogue numbers that are the same in the GameCopy table.

The problem is that I have to reserve a game - not a game copy. When I have made a game available (it has been returned) I have to indicate this in the reservation table. I could have many different reservations for the same game so I need to only update the oldest reservation and indicate that a game copy is available now.

Summary:
One "Game"
Several "GameCopy" using "Game" as a foreign key
Reservation table with possibly several reservations for the same Game - not GameCopy(s)

In other words I have an "Available" field in the reservation table and a "date reserved". I need to create an "Available" (Date()) entry for the oldest DateReserved entry on that reservation table. I could have done it as a boolean but I decided to use a date instead for logging purposes.

Would I use some kind of "Once only" action to make sure that only one of the reservation entries are updated? I really do not know how to proceed with this.

Obviously if I simply:

UPDATE Reservation SET Reservation.Available = Date()
WHERE Reservation.CatalogueNo=Forms![Current Reservation].CatalogueNo;

...then it will update all of them. I believe there must be a bit more SQL I have to add or something else maybe.

View 5 Replies View Related

Modules & VBA :: Input String In Column Based On Data In Another Column?

Nov 30, 2014

I need to input a string into a column named "EventType". The code should first check if the column "Agent Name" contains any strings. If there is none, it will input "IBM Director" into the EventType column.

Once it has looped through the agent names, the code will then loop through the Details column and input into EventTypes based on what is displayed within the string.

These are the codes that I am using to achieve this, however nothing is being input into the EventType column.

Code:
Private Sub Command11_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Final")

[Code] ....

I think the problem lies with the code that checks the agent name. When I removed it, it managed to populate the EventType column based on the details. But I still need to find out how to check the agent name too.

View 4 Replies View Related

Modules & VBA :: Clear Data From Table In Another Database

May 13, 2015

I have an append query that adds data to a table in another database, but I want it to replace the data every time it's run. How do I clear the data before running the append query? The databases are not linked, and I don't want them linked.

View 9 Replies View Related

Modules & VBA :: Convert Number Column Into String Column

Feb 28, 2014

I want to convert a number column into a text column.

Number Column is called Customer.

Below I can't match to the other table containing the text column Customer No.

How can I convert columns in vba?

Code:
strSQL = "SELECT CALCULATED_Forecast_TNS.*, USEFUL.TRP_in_EUR " & _
" FROM USEFUL INNER JOIN CALCULATED_Forecast_TNS ON (CALCULATED_Forecast_TNS.[Reference No] = USEFUL.[Reference No]) AND (USEFUL.[Customer] = CALCULATED_Forecast_TNS.[Customer NO])"

Set qdf = CurrentDb.CreateQueryDef("REPLACABLES", strSQL)

DoCmd.RunSQL "UPDATE REPLACABLES SET CALCULATED_Forecast_TNS.TRP_in_EUR = USEFUL.TRP_in_EUR"

View 1 Replies View Related

Modules & VBA :: Function To Clear Out Unwanted Bits Before Exporting As CSV

Sep 20, 2013

I've put the following Function together to clear out unwanted bits before exporting as csv. I was just wondering if there's a way of holding the table names together with a total count of each item replaced? I wasn't sure if these were stored and could be returned?

Code:
Public Function ClearCommas()
On Error GoTo ClearErr
Dim db As DAO.Database
Dim tb As DAO.TableDef
Dim fld As DAO.Field

[Code] .....

View 4 Replies View Related

Modules & VBA :: Clear SQL Stored Proc Param List

Jan 6, 2014

I am calling a stored proc and passing some params (sql). i need to loop through the execute a few times though before I kill the connection.

I am getting an error saying there are too many params on the second run through. What i need is to clear the param list once it's executed once.

Is this possible or to i need to keep killing the conn then re-connecting to the db?

View 1 Replies View Related

Modules & VBA :: Clear Textbox After User Enter Invalid Date

Jan 7, 2015

I am trying to clear a textbox after the user enters an invalid date and I do not know why the following code is not working:

Private Sub txtStart_AfterUpdate()
If Not IsNull(Me.txtStart) Then
If Not IsDate(Me.txtStart) Then
MsgBox "You have not entered a valid date"
Me.txtStart = Null
Me.txtStart.SetFocus
End If
End If
End Sub

View 3 Replies View Related

Modules & VBA :: Update A Column With Its Last Value And Concat To Value Of Another Column

Apr 16, 2015

DoCmd.RunSQL (" update tbl_userinformation SET [05-Henrichpiramid] = Yes where Username= Text146.value AND actualdate=Text148.value ;")
DoCmd.RunSQL (" update tbl_userinformation SET [combination] = [05-Henrichpiramid] where Username= Text146.value AND actualdate=Text148.value ;")

i want to update the column combination to its last value with concatanation to the value of current column.

View 11 Replies View Related

Modules & VBA :: Writing 2 Column Data Into 1 Column

Sep 18, 2013

I have a table that contains:

item | quantity
123 | 1
456 | 10
789 | 4

I need to get this data listed into a table that just has item and for it to look like this:

123
456
456
456
456
456
456
456
456
456
456
789
789
789
789

I understand and have accounted for the obvious primary key issue.how to get the data to display out like this.

View 1 Replies View Related







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