This worked fine in 2003 but after the upgrade, I get a 'Compile - Method or Data Member not found'
I am sure there is an easy solution and would like some help. The code is below:
Expand|Select|Wrap|Line Numbers
- Private Sub b1_Click()
- On Error GoTo e1
- Me!zz = Null
- 'ensure the zip file is not being modified
- Set fso = New FileSystemObject
- hold_import_path = "Q:\Biz\Administration\File Exports Imports\"
- hold_import_name = "Base Report for All.xlsx"
- If Not fso.FileExists(hold_import_path & hold_import_name) Then
- mess = "Sorry I cannot find the file"
- mess = mess & crlf & crlf & hold_import_path & hold_import_name
- MsgBox mess, 0, "File not found"
- Set fso = Nothing
- Exit Sub
- End If
- Set fso = Nothing
- 'open the excel sheet
- Set xlapp = New Excel.Application
- Set xlworkbook = xlapp.Workbooks.Open(hold_import_path & hold_import_name)
- Set xlworksheet = xlworkbook.Worksheets(1) '("sheet_name")
- screen_pos = 2 'position on excel sheet to start reading
- While Len(xlworksheet.Range("a" & Format(screen_pos))) > 0
- hold = xlworksheet.Range("a" & Format(screen_pos))
- If IsNumeric(hold) Then
- '[Employee_PVE] table
- hold_crit = "select * from [Employee_PVE] where [Employee_PVE].[Emp Id] = " & CLng(hold)
- Set curr_rs = curr_db.OpenRecordset(hold_crit)
- If curr_rs.RecordCount > 0 Then
- curr_rs.Edit
- End If
- If curr_rs.RecordCount = 0 Then
- curr_rs.AddNew
- curr_rs![Emp ID] = xlworksheet.Range("a" & Format(screen_pos))
- End If
- curr_rs![Name] = xlworksheet.Range("b" & Format(screen_pos))
- curr_rs![Division] = xlworksheet.Range("c" & Format(screen_pos))
- curr_rs![Team] = xlworksheet.Range("d" & Format(screen_pos))
- curr_rs![Location] = xlworksheet.Range("e" & Format(screen_pos))
- curr_rs![Occupational Category] = xlworksheet.Range("f" & Format(screen_pos))
- curr_rs![Gender] = xlworksheet.Range("g" & Format(screen_pos))
- curr_rs![Date Started] = xlworksheet.Range("h" & Format(screen_pos))
- curr_rs.Update
- curr_rs.Close