Search results

  1. R

    VBA to populate userform listbox from a table

    I am trying to find the correct VBA syntax to populate a listbox (on an Excel userform) with column headings, from a table reference. The following code works but does not display column headings: ****************************************************************************************** Dim...
  2. R

    Multiple values in query criteria from one form combo box

    Your solution looks like the exact code I posted. The "Or" operator does not work. I did get it working though, with the following solution: WHERE ((dbo_SalesHisItemPcVw.Branch)=...
  3. R

    Combo box result and iif statement

    Thank you for your help. I was able to simplify the solution you posted a little more and got it working. This is what ended up working for me: Where ((dbo_SalesHisItemPcVw.Branch)=...
  4. R

    Multiple values in query criteria from one form combo box

    I have a combo box on a form that has only three values, ‘All’, ‘Pet’, or ‘Shoe’. The logic I’m trying to achieve is as follows: If selected branch = “Shoe” then Branch = “01” If selected branch = “Pet” then Branch = “05” If selected branch = “Both Shoe & Pet” then Branch = “01” or “05”...
  5. R

    Combo box result and iif statement

    Sorry. Thought it would be easier in one thread. Will repost. Sorry for the inconvenience.
  6. R

    Combo box result and iif statement

    I have a similar problem. I also have a combo box that has only three values, Branch 01, Branch02, or BothBranches. WHERE ((dbo_SalesHisItemPcVw.Branch)=IIf([Forms]![frmRollingDates]![cboBranch]="01","01",IIf([Forms]![frmRollingDates]![cboBranch]="05","05","01" Or "05")) If the user wants both...
  7. R

    Trying to populate form text boxes from a query

    Problem solved! :) Your suggestion to test for EOF made me take another look at my query. I had verified that the item existed so I didn't think about an empty dataset, but when I checked my query, the item was not getting picked up because I needed a "Left Join." Thanks for your help!!!
  8. R

    Trying to populate form text boxes from a query

    Can someone tell me what’s wrong with this code? I have a NotInList event that displays the Add New Record button and calls the below function. This function (PopulateItemTxtBoxes) is supposed to run a query to collect all the item information needed from a set of tables, populate/store that...
  9. R

    Function to pull data from a query into text boxes on a form

    Can someone tell me what’s wrong with this code? I have a NotInList event that displays the Add New Record button and calls the below function. This function (PopulateItemTxtBoxes) is supposed to run a query to collect all the item information needed from a set of tables, populate/store that...
  10. R

    VB Runtime error 1004 trying to set Bold property in Excel spreadsheet

    I have a button on a form that exports a datasheet form to an excel spreadsheet. I have coded a VB function to do some formatting of the exported spreadsheet. All of it has worked up to this point. One of the things it does is subtotal the worksheet. I have just received a request to Bold the...
  11. R

    Excel not ending after launching through Access VB code

    Here is my working code for anyone else who might need help: Function test() Dim objXL As Excel.Application Dim xlWB As Excel.Workbook Set objXL = New Excel.Application Set xlWB = objXL.Workbooks.Open("\\Path\Filename.xlsx") With objXL .Columns("I:I").Select .Selection.FormatConditions.Add...
  12. R

    Excel not ending after launching through Access VB code

    You guys are great! Thanks so much! Works now!
  13. R

    Excel not ending after launching through Access VB code

    Thanks for the link. I changed my code as suggested in the blog and am still having the same problem. It runs fine the first time but errors out the second time around. I get a “Run-Time error ‘91’: Object variable or With block variable not set” The blog link says this will happen if the...
  14. R

    Excel not ending after launching through Access VB code

    I have a datasheet form that exports as an Excel file (through an embedded macro on a button click event). I then call a function (in that same macro) that opens the Excel and the file and applies conditional formatting and subtotaling to it. This works fine except that after I close the Excel...
  15. R

    Item not found in collection error

    I think I figured out where I messed up. My code is right but I had removed the [Forms]![frmInvValItemMaint]![txtStkCode] criteria reference from my query. Once I added that back in, all seems to work now. Thanks!
  16. R

    Item not found in collection error

    That did not work either...same message. :(
  17. R

    Item not found in collection error

    I am trying to establish a recordset in which I can pull information from a query to populate text boxes on a form. I want the query results to be based on two fields on the form (item & warehouse). My original code was giving me the “too few parameters. expected 2” error. I had the parameters...
  18. R

    Custom data for first row (index 0) for combo box

    Very clever!!! That worked beautifully! Thanks so much for your help!:)
  19. R

    Custom data for first row (index 0) for combo box

    Thanks! I really apprecitate your time. I checked out the link you provided and got it to work with this: SELECT dbo_SCCurLotNumTestDB.StkCode, dbo_SCCurLotNumTestDB.LotNum, dbo_SCCurLotNumTestDB.DateChanged FROM dbo_SCCurLotNumTestDB UNION SELECT " Choose an item..." as firstItem, Null as...
  20. R

    Custom data for first row (index 0) for combo box

    I have an unbound form with a combo box that lists item numbers. The row source for the combo box is a lookup query. I started with using the following to at least get the box to always display the first item either on Form Load or on Got Focus (this works fine): Me.cboItem =...
Top Bottom