Modules & VBA :: Trimming White-space After Pulling Data From Excel Cell?

Apr 15, 2014

I've got a piece of VBA scripting which runs as an event linked to a button on my MS Access form.

I maintain a database of members of staff at my organisation. It's pretty outdated...

I'm basically wanting to pull in their updated data (extracted from on our payroll system) from a spreadsheet, into a form, when clicking a button on a particular person's record.

This is what I have so far.

Code:
start = Forms!frm_main2!txt_start_row.Value - 1
conv = DDEInitiate("EXCEL", "Staff List.xlsx")
cell_employee_number = "R" & start & "C1"
cell_surname = "R" & start & "C2"

[Code] ....

The function "CStr(DDERequest())" converts the cell number into the readable data, however I seem to have whitespace below the value.

What would I need to do to strip out this whitespace? Would I use strtrim? If so, I am unsure of the syntax... how would I incorporate strtrim into the above?

View Replies


ADVERTISEMENT

Forms :: White Space In Datasheet View?

Feb 3, 2014

How can I remove the white space that follows the last record in my datasheet forms? Please refer to attached image. This happens in two different forms, scrolling in two different directions.

View 8 Replies View Related

Access 2003 SQL View Loses White Space Changes

May 2, 2007

Hello,

Is there a way to configure Access so SQL View saves white space changes to a query? By white space changes I mean tabs, spaces and carriage returns added to make the query more readable in SQL view.

For instance:

When I'm editing a complex query in Access, I space it out nicely like:

SELECT ((field1 * field2) + (field2 * field3)) / field4 AS [Weighted Avg]

FROM table1, table2, table3

WHERE table1.field = 'xxx'

or something similar, with spaces between fields, parenthesis, and carriage returns or tabs in between major blocks of logic to increase readability. It's simplified above but I hope you get the point.

When I save it and return to SQL View later, Access compacts the query to:

SELECT((field1*field2)+(field2*field3))/field4 AS [Weighted Avg]
FROM table1,table2,table3
WHERE table1.field='xxx'

The above example isn't so bad, but with multipe selects, joins and mathematical calculations using parenthesis, it becomes really unreadable after Access "compacts" it.

Any way to change this lovely "feature" ?

Thanks,

-Scott

View 1 Replies View Related

Forms :: Removing White Space Between Fields On A Datasheet?

Sep 11, 2014

how to remove the white space between fields. See attached image for an example

So far I have tried hiding gridlines, setting them transparent, removed margins, removed padding, and setting just about everything that is to do with borders to transparent in the properties list.

None of the above seems to affect how the fields display, in fact turning gridlines on and setting them really thick and a different colour doesn't change how it displays. Is this a bug with conditional formatting in Access, or am I missing something obvious that's overwriting my formatting selections?

View 3 Replies View Related

Forms :: Hide Form Controls And Resulting White Space

Sep 20, 2013

I have a checkbox that determines whether or not to display certain form controls. How can I also hide the resulting white space that comes from hiding the form controls?

Can I put all of the controls in some sort of container and hide the container? The form objects are all displayed in order, so it shouldn't cause issue.

Can I create a subform for the objects and hide it? This would make the main and subforms based off of the same table.

Occam's Razor would be the preferred philosophy in this case. Nothing too fancy is needed.

View 4 Replies View Related

Forms :: Allow Horizontal And Vertical Scrollbars But Remove White Space (AC2007)

May 22, 2014

I have a form which I would like to enable scrollbars both horizontally and vertically (the main reason being, the application is designed for users with large / wide screens but may at some point be required on smaller screens)

Currently I have the scrollbars switched off and the form maximises but everything goes to pot if I resize the window. I'd like to add the scrollbars so if a user wants to resize the window to, say, half the screen, they can still scroll across to the 'hidden' parts of the form.

The problem with this is, if the form is maximised - or at least large enough to show the entire form - the area of the screen where the horizontal scrollbar resides is white (whereas the background colour of the form is a pale green) Which is quite unsightly.

I know I can remove the problem by removing the horizontal scrollbar and the navigation bar (which is already gone!) but then I can't scroll?

Is it possible to have a horizontal scrollbar but not have that white space at the bottom when the scrollbar is not required?

(Doesn't appear to be a problem with the vertical scrollbar?...)

View 8 Replies View Related

Forms :: Datasheet White Space - Records Not Showing In Size Allowed

Dec 11, 2014

I have a datasheet on a form that is unable to show all records in the size allowed. Consequently it has a vertical scroll bar. However, the scroll bar allows scrolling to the bottom whereby there is white space almost the same size as the data records. The horizontal scroll bar does much the same.

Is it possible to just show the records and only the width of the data in them.? No extra records exist in the table to cause this.

View 2 Replies View Related

How To Determine # Of Rows In Excel Worksheet Before Pulling Data In To App?

Dec 19, 2005

Hey folks.

I have an Access db needing populated via a worksheet with unknown # rows and known # of columns. Before pulling this data in I must do a row count to determine how many records will be added to the db. Otherwise, it would be a very simple thing to just copy the contents of the worksheet over.

Known:
- Only using DAO.
- The access table is already created matching the column count in the worksheet.
- The spreadsheet will have an unknown row count.
- Some rows in the spreadsheet will have various cells empty.
- A completely empty row will mean EOF.

Need:
- I need to determine how many rows are in the spreadsheet before copying into db.

Problem that occurs from attempt:
- Overflow issue. I seem to be counting every single row on the worksheet, even though only 2 contain data.

Any ideas out there? Pasting below my latest attempt.


Dim strStorage as integer
strStorage = CLng(xlsWST.Rows.Count)


Thanks folks.
-Tethys

View 4 Replies View Related

General :: Pulling In Data Similar To Vlookup In Excel

Aug 18, 2015

In my Access Database, for each row, there are two queries I want to pull data from to give me the status of the item in the related columns. In Excel, I use one file with multiple tabs to vlookup the data. How would I accomplish this in Access?

For Example, Jacksonville has a value of Submitted in the Completed Checklist Column and Approved in the Parts List Column. These values currently come from two separate tables. How do I get my database table to update when the status changes for each of the columns?

View 1 Replies View Related

Modules & VBA :: Passing Excel Cell Date To Access Query

May 1, 2014

I'm having a rough time trying to figure out how to pass a date to an SQL statement that Excel VBA macro will run. The date is in a cell (A1) formatted as 'm/d/yyyy'. Let's say it's 2/1/2014. I want to run an SQL statement that retrieves data from a table where a field is greater than 'A1'. The table field is a date/time field and has values formatted as 'mm/dd/yyyy'.

I've tried various syntax on the Where but cannot get it to work.
sd = Range("A1")
SELECT [tn].[Date Submitted]
FROM[tn]
WHERE tn.[Date Submitted] > """ & sd & """

This results in the following where clause that does not work.
WHERE tn.[Date Submitted] > "2/1/2014"

View 4 Replies View Related

Modules & VBA :: Excel File Export Auto Cell Width?

Jun 26, 2014

I have the following code to export a query into a excel file:

Code:
Dim outputFileName As String
outputFileName = "C:AccountSpreadsheet est.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Q_Search_Invoices", outputFileName, True
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open "C:AccountSpreadsheet est.xls", True, False
Set xlApp = Nothing

This works almost exactly how I want it to work.

The only thing wrong is that the columns are all the same width and they are all to narrow.

Is there a way to make the columns automatically become the width of the longest text within them (exactly what happens when you double click on the side of a squashed column in excel)?

View 5 Replies View Related

Modules & VBA :: Open Excel Workbook From Access - Clear Cell Contents

Dec 5, 2013

I would like to open an Excel workbook from MS Access and clear cell contents, or just delete some records in a specific worksheet.

If you open the test workbook, cell contents in RAW need to be deleted by calling from Access.

I have produced some code but it's partially working.

Code:
Sub TestFileOpened()
' Test to see if the file is open.
If IsFileOpen("test.xls") Then
' Display a message stating the file in use.
MsgBox "File already in use!"

[Code] ....

If you put this in a standard module in access, the function works, but the part that doesn't work is where it says "activesheet". It somehow tries to recognize it as a variable, but it's not going to be a variable.

View 3 Replies View Related

Queries :: Pulling A Cell From One Table To Another Based On (Account Number)

Jul 22, 2013

Table 1:
Account Number
Start Date
End Date
Cost data**
Budget data**

Table 2 (Imported excel file with cost/budget data):
Account Number
Cost data**
Budget data**

Table 1 is the main table that will be viewable in this database. The idea here is that new Account Numbers can be added to Table 1 throughout the year. It then pulls the cost/budget data into Table 1 based on the matching Account Number between table 1 and 2.

So, if the Account Number (Table 1) = Account Number (Table 2) then it pulls the cost/budget data into the cells on that row. I am trying to make this automated since this data is updated weekly and imported into Table 2 from excel.

View 4 Replies View Related

Modules & VBA :: Pulling Data From Other DB To Current DB

Jun 5, 2014

I'm trying to make a button on a form that pulls data from a table in a database on a network share to the current open database (with the form).

Database on network share info:DB location: est.com est estdb.accdb
Table in DB: Table1

The current open database has the exact same table:Table2.In the following VBA line I get Runtime Error 3126: Invalid using of bracketing in name '' (The quotes at the end are 2x ')

Code:
DoCmd.RunSQL "INSERT INTO Table2 SELECT [ est.com est estdb.accdb].Table1.* FROM [ est.com est estdb.accdb].Table1"

I tried everything with changing the [, " and even the path name of the external DB as variant of type string. Nothing seems to work.

View 3 Replies View Related

Trimming Data In Listbox

Oct 26, 2006

Another issue for my contacts database for work. I have a listbox on the edit contacts form that lists all contacts in the database.

The listbox rowsource is
SELECT [ContactID], [LastName] & ", " & [NamePrefix] & " " & [FirstName] & " " & [Business/Organization] FROM tblContacts ORDER BY [LastName] & ", " & [FirstName] & " " & [Business/Organization];

Some of the contacts that are businesses or organizations, do not actually have the first and last name filled in, just the business/organization name. So what happens in the list I get all of the entries that do not have FirstName/LastName at the top of the list, with the Business name following a few spaces. The way it looks is:

, Stop & Shop Supermarkets

But I would like to trim that beginning part if there is no FirstName/LastName so that Stop & Shop Supermarkets gets sorted with the S's, like this:

Stabile, Lisa
Stop & Shop Supermarkets
Stott, Joan

Is there something I need to put in the rowsource to accomplish this? I've searched these forums for an answer, and turned up no results.

Attached, I have a screenshot of the form with the listbox.

Thanks
ScrmingWhisprs

View 4 Replies View Related

Modules & VBA :: Concatenate Data In One Cell In A Report / Query

Mar 27, 2014

Watch the below tables.

I have a large ACCESS list as per the left one and I would like to make it as per right.

The problem is that I want to concatenate the "invoices" in one record separated with a coma , .

This is the only way I can compact the long list into a short one and make it comprehensible.

The invoices , in one cell, very rarely are more than 4 or 5 items.

So room for 6 is just perfect.

View 8 Replies View Related

Modules & VBA :: Pulling Data Using Query - Combine Two Functions Into Third Function

Jun 28, 2013

I created two functions to use when I'm pulling data using a query (QBE). I would like to combine the two into a 3rd Function that works like this:

BB_Only = DishNetActivityCode = 1 and VideoActivityCode = 0
Hybrid = DishNetActivityCode = 1 and VideoActivityCode = 1
V_Only = DishNetActivityCode = 0 and VideoActivityCode = 0

Function DishNetActivityCode(service_code_string As String) As Integer
Dim CodeArray, i As Integer

[Code] .....

View 14 Replies View Related

Excel Cell Value Not Same As Value Written To It

Feb 14, 2008

Has anyone else had this problem?

I have a program that brings in the upper and lower specs to a excel spreadsheet and then brings in the values from lab tests.

The program then uses the specs to determine if the value is in or out of spec and colors the value if it is out of spec.

My problem is that in one cell the upper spec that is brought in is 2.7 and it shows that on the spreadsheet but when you click the cell the true value stored there is something like "2.66990153". Since a test value of 2.7 is greater than that it colors it when it is in fact in spec.

I have stepped through the code and the spec value pulled from the table is coming in correctly at 2.7.

Why would the excel sheet have a different value?

View 6 Replies View Related

Want Linked Excel Cell 2b Memo Not Text?

Oct 13, 2005

I linked an Excel table and now, in both the table and report, the cell is limiting itself to 255 characters, even though the Excel cell has more. I checked the "data type" and it says "memo" but it keeps truncating to "text".

Where is this limit coming from and can I change the linked table so it won't truncate the text?

thanks :confused:

View 1 Replies View Related

Reports :: Set Attachment Image Into Excel Cell

Dec 26, 2013

My form: "Dailyissue"
My attachement field: "Attachement_1"

I attached an image in Attachement_1, I want to set that image in a cell of excel using VBA. How can I do it? (I don't want to read the image from the PC, I want to use the attached image).

View 1 Replies View Related

Tables :: Update Cell In Linked Excel Spreadsheet?

Jan 22, 2015

I have an access database with a linked table to an Excel spreadsheet. I have a form based on the linked table so the presentation of the Excel date is better. The spreadsheet is used by other staff in my office to record sales which I need to register with an external organisation. What I want to do is update the spreadsheet with the registration date from my access form rather than going back into excel to do it.

View 2 Replies View Related

Export Multiple Rows Into A Single Cell In Excel?

Sep 18, 2012

I need to export a list of data into a single cell in Excel.

As an example the list looks like this in Access:

450a

650b

320c

4100d

and exports into individual cells. I need it to export into one cell and look like this:

450a, 650b, 320c, 4100d

View 4 Replies View Related

Tables :: Import Excel File Set Up - Field Has Lead Space

Jul 22, 2014

I'm trying to set up an import of an Excel file. One field in Excel, "Sales Tax" has a lead space, so " Sales Tax" is its Excel name. Since I can't name a field in Access starting with a space, the only way I know to import properly is to manually remove the space from the Excel file. While this isn't actually that difficult, I'm trying to avoid this manual step if possible.

View 9 Replies View Related

Reports :: Excel Template File - Direct Access What To Put In Which Cell?

Nov 24, 2014

How much formatting can be done to a report from Access into Excel? I am trying to (or will be in the next day or so) to create a report to export data and I would like it presented in a specific format. This is hopefully to replace a spreadsheet where someone currently has to collate and re-type a load of info that has already been typed into various other spreadsheets.

Access is going to happily cope with all of those users entering their data to a table, and I would like to be able to output that data to something similar to the end result now? Is there a way to have an Excel template file and simply direct Access what to put in which cell?

View 14 Replies View Related

Forms :: Changing Embedded Excel Sheet Cell Value - Access 2010

Mar 9, 2014

I would like to embed a blank worksheet in access form. I want to do a macro to change the cells value when I click on a button, but I don't know how to do it?

View 3 Replies View Related

Combining Data Into One Cell Only IF Data Exists

May 15, 2013

I currently have an access database for tracking company assets and performing maintenance tasks on them.We also have a number of Stores Stock Items that are controlled under a separate finance package.We currently have forms that create individually numbered "Job Cards" in the Job Cards Table..we input the data and manually type into a Text Box the we have used 'X' number of Store Stock 'Item Y'

I have then use a query to export the data i need (Job number, dates, location and Store Stock Items).But I have to manually re-construct the data and items into separate lines in an excel sheet for a paste operation into the finance package (lots of typing of 16 digit stock codes)

What i want is to use a second table (linked via the "Job Card#" key).It will be called "Stock Items" which has a separate field for each of our stock items.the user then just opens second form while creating the job that immediately creates a new record.The user then simply has to put the number of each item used in the relevant text box on the form and close.

example of datasheet view
Job# __ ItemX __ ItemY
2417_____3_______7

Now, I have all of that working as I want, But i nee to be able to combine the data from each field into a single field (either in access or excel).What I want to see is a field containing 3x ItemX, 7x ItemY, etc

if there are none of one or more items, I don't want anything displayed for that item (blank space is ok)I have 30 or more stock items, so there will be 30 or more columns in the table. the actual data stored in the table is simply the quantity of each item used.

this data is used twofold,on export to Excel I can split the data into new cells and it's used on a despatch note that is returned with the item so the end user can see the items that were used in the repair.So it needs to be done upon saving the record, record by record.

View 5 Replies View Related







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