If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Excel & Access Reporting
I have a report in access where I am extracting some data out of excel to
generate the report. The code runs with out error, but comes out blank. On the report the controls are lbl20-lbl27, & txt20-txt27. All of them are labels. In the past I haven't been able to write excel to a text box. Below is my code: ClosingCount = 20 CenterCount = 40 CellNum = 3 PercentVAR = 5# Set XLAPP = GetObject("Excel.Application") 'checks to see if an instance of excel is running If Err.Number 0 Then ' excel was not running Set XLAPP = CreateObject("excel.application") ' creates an instance of excel End If XLAPP.Visible = True XLAPP.displayalerts = False XLAPP.UserName = "PostCloseAnalyst1" 'Opens workbook SysCmd acSysCmdSetStatus, "Opening Excel" XLAPP.Workbooks.Open filename:="G:\Users\Post Close\clserr\NewPostClosing\ TotalErrors.xls" Do While ClosingCount = 27 And PercentVAR 4.49 / 100 XLAPP.Windows("TotalErrors.xls").Activate XLAPP.sheets("Summary").Select XLAPP.Range("B" & CellNum).Select PercentVAR = XLAPP.activecell If XLAPP.activecell = 4.49 / 100 Then XLAPP.activecell.Offset(rowOffset:=0, columnOffset:=-1).Activate Call CheckCenter(XLAPP.activecell) 'NJM 12/10 If bCenter = False Then 'closing errors XLAPP.activecell.Offset(rowOffset:=0, columnOffset:=1).Activate Report!memorandumNJM.Activate tempT = "txt" & ClosingCount memorandumNJM.Controls(tempT).Caption = XLAPP.activecell XLAPP.Workbooks("TotalErrors.xls").Activate XLAPP.Windows("TotalErrors.xls").Activate XLAPP.strCellLoc = XLAPP.activecell XLAPP.activecell.Offset(rowOffset:=0, columnOffset:=-1).Activate Report!memorandumNJM.Activate tempL = "lbl" & ClosingCount memorandumNJM.Controls(tempL).Caption = XLAPP.activecell memorandumNJM.Controls(tempT).Caption = Format(memorandumNJM. Controls(tempT).Caption, "#0%") ClosingCount = ClosingCount + 1 End If End If CellNum = CellNum + 1 Loop Any help is appreciated. Holly -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/200801/1 |
Thread Tools | |
Display Modes | |
|
|