Search results

  1. I

    CopyFromRecordset does not keep sorting of recordset

    All I have sub below which exports an ADODB-recordset to Excel. Before the export, the recordset is sorted. In the loop I print out the supplier name in the Immediate window where the values are indeed sorted upon supplier name. However, in Excel the records are in the original order instead...
  2. I

    Listbox "before update"-event

    All I have a listbox where all of the values are selected by default on opening the form. The user is able to (de)select values, but there must always be at least 1 value selected. What is the target? Suppose there is currently one item selected. If the user deselects it, that specific entry...
  3. I

    Rowset does not support fetching backward

    All I have next code. An error "Rowset does not support fetching backward" occurs on line rs.movelast. I've tried all possible values for rs.CursorLocation. Does someone have a solution? The recordset contains the requested records and I can navigate by using rs.MoveNext.
  4. I

    How to automatically set cursor to first record (in subform of a tabcontrol)

    All I have a form called frmMain. This form contains a TabControl named tabMain tabMain has some pages. One of the pages is called pagRecords pagRecords contains a subform called frmRecords. frmRecords contains records from an in-memory table. My problem: If I select tab pagRecords the...
  5. I

    in memory ADO-recorset: no current record

    All I use MS Access 2010. I have code below and created a form with two textboxes where property "control set" is set to "first" and "last" respectively. I enabled the reference "Microsoft ActiveX Data Object 2.8 Library". Private Sub Addnew(ByRef rstADO As ADODB.Recordset, strFirst As...
  6. I

    SQL String does not retrieve Primary key newly added record

    All I have an Access 2010-form which inserts a record in a MS SQL 2008-database by using an ADODB-connection. I need to retrieve the primary key of the newly added record. With code at the bottom I create a SQL-string which is stored in variable strSQL. If I execute the SQL-string...
  7. I

    MS-access VBA code does not add Excel's top row freeze correctly

    All I have an Access application which creates an Excel-file with multiple sheets by using VBA. For each Excel-sheet I want a "freeze on the top row". I tried several things with sample code I found on the Internet, but the freeze is always placed between column G:H and row 4:5. This...
  8. I

    code fails after second loop

    All For some reason next code fails after second loop on line oXL.Range("A" & Rows.Count).End(xlUp).Offset(1).Activate The first loop works perfect. I even have to reopen the form to get it work. Does someone have a solution or an idea why this code fails? lstData is a listbox. The purpose...
  9. I

    Update x Rows not working

    All I use next SQL-command in MS SQL 2008 to update the top 1 record of my table. However, all records with FK=826 and status='' are updated. update tblO set Status='In', Oms='20331266' where fk in (select top 1 fk from tblO where status='' and fk=826) Does someone have a solution...
  10. I

    Open ODBC-table as read-only

    All I have next code in my MS Access 2010 to make a connection to a SQL-table. The code starts with the function Startup() and creates an ODBC-connection to a table "mytable" on an SQL-server. All of below works, but there is one problem. I only have one account which has full control on the...
  11. I

    Open query with "form element" as a dao.recordset

    All Hereby a simplified example of my problem. I created a form with a combobox and a regular Access Query with next SQL-code SELECT tblItems.Item, tblItems.Cost, tblItems.ID FROM tblItems WHERE (((tblItems.ID)=[forms]![frmmain]![cboItem])); If frmMain is open and you select an item...
  12. I

    Create a comment on a cell in Excel via MS Access 2007 VBA

    All I have a MS Access application which creates an Excel-file. From MS-Access I need to put Excel cell comments, but I can't find the right code. I started with an Excel macro and tried to rewrite it into my Access-code. The recorded macro code in Excel is Range("B10").AddComment...
  13. I

    Calculate weeknumber based upon non-default startdate

    All I need to write a query which retrieves the weeknumber from the datefield. The datefield is in the format dd/mmm/yyyy hh:nn There is however one oddity: a new week starts at Friday evening 22:00 hour. Friday 28th of December 2012 22:00 was weeknumber 1. Weeknumber 2 started at Friday...
  14. I

    Change a value in a multi-column listbox

    All I have a listbox with 2 columns. The rowsource is not bounded. Values are picked up from a table. Colde below fills the first column of the listbox. Do While Not rsExpectedColumns.EOF Me.lstColumns.AddItem rsExpectedColumns![Column] rsExpectedColumns.MoveNext Loop In next step...
  15. I

    File remains open

    All I have a combobox which shows some files from a specific folder. Furthermore I have a button "cmdLoadPreset" to open the file currently chosen in the combobox. The code inside "cmdLoadPreset" calls another sub LoadPreset with the filename as parameter. This code does work as the content of...
  16. I

    Retrieve column names and column data from MS-SQL Stored Procedure

    All I use Access 2007 in combination with "MS SQL 2005". On the SQL-server I imported the UberCrossTab-script in order to create dynamic Pivot tables. When I launch the SQL-string on the SLQ-server, I do get the expected result in the "Results"-window. I now need to use VBA-code in order...
  17. I

    ADODB-connection to specific XLSX-sheet

    All I am using Access 2007 and I need to create an ADODB-connection to a specific Excel worksheet. The worksheet is in the XLSX-format and the installed Excel version is also 2007. The name of the worksheet is shtImport. The complete "Office 2007 Enterprise"-suite is installed on the computer...
  18. I

    TextToColumns in Access module

    All I have Excel files with multiple worksheets which are created by some PHP-system. After opening the XLSX, the numbers seem to be in Text-format instead of number. In Excel, I can fix this by using the Text-to-Columns-function. The problem is those XLSX-files needs to be imported in an...
  19. I

    Form based upon ADODB-recordset not updatable

    All According http://support.microsoft.com/kb/281998/en-us I would be able to create an updateable form based upon an ADODB-recordset. However, I did a copy paste the code and changed some parameters. I do get the form with the expected records, but I cannot change them nor add records. The...
  20. I

    Create XLSX worksheets

    All I am trying to create an Excel 2007 file with multiple worksheets via VBA-code in Access 2007. The name of a worksheet is based upon a value in a table. With code below, I get error message "run-time error 9: subscript out of range". The first time the code goes into the while-block, it...
Back
Top Bottom