...to load an Excel spreadsheet. One gives the Run time error 3061 or asks for a list separator. This is the code:
Set RS = DB.OpenRecordset("SELECT * from qryRTRACK_EMP Where" _
& "([SDate] Between #" & Forms![frmReports]![Text0] & "# And # " _
& DateAdd("d", 6...
PHV, thank you. That works. I also found a WITH statement that works as well. I use it to find the Last Row for looping and Last Column for looping with an autofit. Both work well. The WITH statement is below. Have you ever done row checking for visibility? I loaded the names from one file...
Rebecca and PHV, I made a copy of the code and commented out a lot of the code that accessed the Excel application. I ran the routine and no ghost. Then I began slowly un-commenting out parts of the code, each time running the routine. Each time Excel closed with no problem. The line of code...
Rebecca, thank you for you help but still a ghost. I even tried switching it over to Sub Routine and still have the ghost. I may end up with just a work around. If I can't get it working here than I was thinking about putting the code into the Workbook Open module so when the user opens the...
RMcCallan, Tried the changes as follows and still have the ghost. But whenever I run the function the first time after making the changes I get the remote server error. Then I reset the code and End Process the Excel.Exe and then rerun the function. It runs and leaves me with the ghost...
Sorry, PHV. The code above is pretty much the code of the function except there are more conditions of the IF statement. All I did was replace XL.ActiveSheet with objActiveWrksheet. But it is all pretty much there. I deleted all of my code comments to try and make the excerpt smaller.
...As Object
Dim objActiveWrksheet As Object
Dim objActiveWkb As Object
Dim LRow As Integer
Set DB = CurrentDb()
Set RSL = DB.OpenRecordset("SELECT * from LABENTRY WHERE LLEVEL=1 ORDER BY LENTRY", dbOpenDynaset, dbReadOnly)
Set XL = CreateObject("Excel.Application") '
Set objActiveWkb =...
PHV, I tried your suggestion and the first time I ran the routine I received the remote server error. Then I ended the Excel process and ran it again and it ran without the server error but still Excel does not close. It has to be something with the LRow and the DO UNTIL loop because I used the...
...Dim ExcelSheet As Object, XL As Object
Dim DB
Dim RSL
Dim X
Dim LRow As Integer
Set DB = CurrentDb()
Set RSL = DB.OpenRecordset("SELECT * from LABENTRY WHERE LLEVEL=1 ORDER BY LENTRY", dbOpenDynaset, dbReadOnly)
Set XL = CreateObject("Excel.Application") '
Set ExcelSheet =...
...Dim DB
Dim RSL
Dim SName As String
Dim Counter As Integer
Dim LastCounter As Integer
Set DB = CurrentDb()
Set RSL = DB.OpenRecordset("SELECT * from LABENTRY WHERE LLEVEL=1 ORDER BY LENTRY", dbOpenDynaset, dbReadOnly)
Set XL = CreateObject("Excel.Application") '
Set ExcelSheet =...
Bob, I tried changing the "Hidden" row to your suggestion - ExcelSheet.Selection.EntireRow.Hidden = True - and I still get the error #438. I also tried removing the Rows(Counter).Select statement and still got the error. The code is extensive otherwise I would post the whole function. Should I...
Thank you both for your input to work my issue. I was able to load the data using the following code which worked well with multiple sheets (SName from one query) and JobCat from another query.
SName = RSL("LENTRY")
RS.MoveFirst
Do Until RS.EOF
If (RS("LENTRY") =...
I have loaded data from a query into an excel workbook with multiple sheets. The load worked fine. Then I reuse a table with the sheet names to try and access the sheets to hide unused rows. The code errors out on the "Hidden" line of code. I do not close Excel before I run this loop so I did...
...me how to not start with an empty sheet but to leave the formatting and other cells alone:
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("Select * from EMP_WRK_SHEET2 WHERE TTYPE='D' ORDER BY EMP_INFO_CAT, EMPNAME, SDATE, HCATEG DESC", dbOpenDynaset, dbReadOnly)
Set XL =...
dhookom, Thanks for the response. The issue is that the Excel spreadsheet has already been created by the Accounting Department. I was able to piece together code from about four or five different threads and I can write to a spreadsheet. Now I just have to work out the VB code and loops to load...
I have an Excel spreadsheet already created with Names in column A and then Thursday's date in Column D, Friday's date in Column E, and so on... with a Total Column with formula in Column K, then Rate of Pay in the next column, and calculated Payoll in Column M. I have the data in Access where...
I am currently using MS Access and Visual Basic coding behind. I have a form called Calendar which displays the month with a Cancel button and a Set Date button. When I run the form that uses the calendar, I have a button to call the calendar form. But when I first click the button a completely...
Thank you, Joanne, for your input. I found it on the Report design. Because I am sorting by the Employee name when I went to the Sort filter on the design, there is an "option" to Keep It All on One Page or not. I set it to keep it on one page and it works. Thank you again.
I have a report that prints the employee hours for each day and then sums the hours for the selected period. The Detail section of the report when it reaches the bottom of the report splits with some days on the first page and the rest of the days on the next page. Does anyone know a way to stop...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.