Search results

  1. I

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

    I found some solution, although it is a rather "dirty" one. If someone knows a better method, please let me know. Dim rs As Recordset Dim QD As DAO.QueryDef Dim strSQLDef, strSQL As String Set QD = CurrentDb.QueryDefs("qryselecteditem") strSQLDef = QD.SQL strSQL = Replace(strSQLDef, "WHERE...
  2. 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...
  3. I

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

    Brianwarnock 1: This is just the way how it works. The VBA-code in Excel just can't be copy/pasted to Access VBA. Excel VBA-code has some commands not known directly by Access VBA, so these have to be modified. Furthermore, many code created by the Excel VBA-recorder is redundant or can be...
  4. I

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

    I think I found the problem: it seems you can't add comments to more than one cell. I get a similar error in Excel when I try Range("B1:B10").AddComment Range("B1:B10").Comment.Text Text:= _ "Description:" & Chr(10) & "test" & Chr(10) & "" & Chr(10) & "case"
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. I

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

    I have now changed the code, but on the WHILE-clause I get: "Run-time error 3704: Operation is not allowed when the object is closed." Private Sub Command110_Click() Dim adoCMD As adodb.Command Dim adoRS As adodb.Recordset Set adoCMD = New adodb.Command With adoCMD .ActiveConnection =...
  10. 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...
  11. I

    ADODB-connection to specific XLSX-sheet

    @mdlueck This is not the same issue. In the link you provided, the connection towards the Excel file fails. In my code, the connection does succeed. It is the SQL-command which does not succeed as shtImport cannot be found, although the sheet does exist. Next code also fails and gives a...
  12. 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...
  13. 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...
  14. I

    Form based upon ADODB-recordset not updatable

    I found the error. Although I was sure the table got a primary key, it seems it did not. I was confused and thought "Identity Column" containted the value of the primary key. I just set the primary key via the correct way and I was able to edit the data in Access. Issue is solved.
  15. I

    Form based upon ADODB-recordset not updatable

    This also results in "The connection cannot be used to perform this operation. It is either closed or invalid in this context" The form contains the ID-field which is also the primary key. I created my form as follows: First I created a link between MS-Access and the MySQL table so the...
  16. 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...
  17. I

    Create XLSX worksheets

    To vbaInet The provided link is an example to open an existing workbook at a predefined worksheet. So both must exist. I need to create a new workbook and inside that workbook an worksheet for each KPI. In meantime I did some further investigation and the code stucks when there is no...
  18. 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...
  19. I

    Create XLS worksheets

    Seems to be published twice. See other question
  20. I

    Create custom report with VBA

    I found a solution. Seems I had to use IF-functions instead of Do While Private Sub Button1_Click() Dim reportmessage As String Dim street As String Dim postalcode As String Dim rs As Recordset Set rs = CurrentDb.OpenRecordset("select * from tblAdres order by postalcode, street...
Back
Top Bottom