Search results

  1. B

    Selecting distinct fields to display in Combo Box

    I'm not sure what you mean... I made sure there were no returns and pasted it in again, but it's still showing up empty. Ah hah! Awesome, thanks! The ColumnCount was 2 and ColumnWidths was 0cm;6.087cm so I changed it to just 6.087cm. :)
  2. B

    Selecting distinct fields to display in Combo Box

    This simple query doesn't show any items in a combo box, but does in datasheet view (5 distinct records, to be exact): SELECT DISTINCT overview.[Risk Category] FROM overview; Apologies if I've neglected to post something that's required; it's Friday afternoon... Cheers.
  3. B

    Argument not optional Error

    Sweet, I think I get that haha.
  4. B

    Argument not optional Error

    You said: Which makes no sense to me. I'm trying to understand this better, so I assumed that you meant, in my case, the variable "f" needs to be a variant when "For Each"ing over a collection. Ok, cheers.
  5. B

    Argument not optional Error

    Er, you mean the enumerator, right? If you do mean the enumerator/control variable/whatever, why does this work, when f is a field object? Private Function getTableFieldNames(tableName As String) As Collection Dim fieldNames As Collection Dim rst As Recordset Dim f As field Dim...
  6. B

    Argument not optional Error

    Huh. I changed f to be a Variant and it worked fine: Private Function getTableFieldNamesStr(tableName As String) As String Dim fieldIdx As Integer Dim f As Variant Dim fieldNamesStr As String Dim fieldNames As Collection Set fieldNames = getTableFieldNames(tableName)...
  7. B

    Argument not optional Error

    Thanks guys, works perfectly: Private Function getTableFieldNames(tableName As String) As Collection Dim fieldNames As Collection Dim rst As Recordset Dim f As field Dim fieldIdx As Integer Dim dbs As DAO.Database Set dbs = CurrentDb Set fieldNames = New...
  8. B

    Argument not optional Error

    Huh? Nope. This is what I'm trying to do: Private Sub importRulesFn() Dim rulesRst As Recordset Dim prvwRulesRst As Recordset Dim relationshipRst As Recordset Dim f As Object Dim isFirst As Boolean isFirst = True Set rulesRst = CurrentDb.OpenRecordset("rules")...
  9. B

    Importing from Excel - How to handle relationship insert

    For anyone who comes across this thread seeking a resolution, this works: ' Add an overview/rules ID pair to the relationship table. relationshipRst.AddNew relationshipRst("ID") = importRulesOverviewCombo rulesRst.Move 0, rulesRst.LastModified relationshipRst("rulesID") = CLng(rulesRst!ID)...
  10. B

    Argument not optional Error

    All I want is to not have to hard-code the field names - I only wanted to return a collection because I wasn't aware of the TableDefs approach. However, this code doesn't work: Dim rulesRst As Recordset Dim prvwRulesRst As Recordset Dim f As Object Dim isFirst As Boolean isFirst = True...
  11. B

    Argument not optional Error

    Even if I pass a collection in instead of having it returned, I get the same error (Wrong number of arguments etc.): ' Taken from: forums.devx.com/showthread.php?t=77974 Public Function getTableFields(strTableName As String, retFields As Collection) Dim dbs As DAO.Database Dim tdf As...
  12. B

    Argument not optional Error

    Ok, so if I use Set, how do I stop the error I mentioned from happening? I'm not sure what you mean by this. Thanks, I'll use a tabledef instead. Could I do something similiar to this (forums.devx.com/showthread.php?t=77974) except return a collection instead of having a "by reference" input...
  13. B

    Argument not optional Error

    Hi. I'm getting "Argument not optional" on the highlighted line: Private Function getTableFieldNames(tableName As String) As Collection Dim fieldNames As Collection Dim Rst As Recordset Dim f As field Dim fieldIdx As Integer Set fieldNames = New Collection Set Rst =...
  14. B

    Importing from Excel - How to handle relationship insert

    I think I've got it working using Recordset: Private Sub importRules() Dim fieldNames As Collection Dim rulesRst As Recordset Dim prvwRulesRst As Recordset Dim relationshipRst As Recordset Set fieldNames = getTableFieldNames("rules") Set rulesRst =...
  15. B

    Importing from Excel - How to handle relationship insert

    Hi. I have implemented functionality that lets the user import data from an Excel spreadsheet into the Access tables in my database. As an example, the user can import many Rules records from a spreadsheet after they've chosen which Overview the Rules records are associated with. The data is...
  16. B

    Subform won't display as Datasheet View in Design Mode

    I discussed having the subform as a single form rather than a datasheet view with co-workers, and they prefer it, so this is no longer an issue. :) I did that and got this error: This happened for more than 1 field.
  17. B

    Subform won't display as Datasheet View in Design Mode

    As the title says, I'm trying to get a subform to display in datasheet view in design mode. I've tried: Setting the subform's Default View to Datasheet in design view whilst viewing the subform directly (and, to be sure, viewing it from within the main form). Setting Allow Form View, Allow...
Back
Top Bottom