Hi Guy's I am struggling with this a little!!!!
Here is my code to clear a contacts page starting with a specific initial, when i open the Xl file to check a page has been updated, there are no pages whatsoever, thankfully as i have been playing around with it, i keep making a back up of the Xl File
What would you say is wrong here ?
Recordset update
Clearing Contents of Page
Im I setting the XL sheet to update correctly ?
The code is running through to the MsgBox to tell me updated
???
Code:
If Me.cboContactOptions = "Update A-Z Range PO Sheet" ThenDim strInput As String
strInput = InputBox("Enter The Single Letter A-Z Page To Update Contacts ?" & vbNewLine & vbNewLine & _
"ie: To Update Page With Contacts Starting With: S Just Enter S etc....", "ENTER LETTER")
Set xl = CreateObject("Excel.Application")
xl.Visible = True
Set xlWrkBk = GetObject(srcPath & srcFile)
Set xlsht = xlWrkBk.Worksheets(strInput)
xlsht.Cells.ClearContents
Set rs = CurrentDb.OpenRecordset("Select tblDealers.Name, tblDealers.Town, tblDealers.Postcode From tblDealers WHERE left(ucase([Name]),1)='" & strInput & "'")
xlsht.Cells(1, 1).CopyFromRecordset rs
MsgBox ("Contacts Page: " & strInput & " " & "Now Updated."), vbInformation + vbOKOnly, "UPDATED"
xl.Quit
Set xl = Nothing
Set xlWrkBk = Nothing
Set xlsht = Nothing
End If