Access Set Validation rules in XLS worksheet created using MS-Access/VBA

Aug 11, 2010
Reaction score
I am using VBA code from MS-Access to export data into different Excel worksheets. The worksheet is created from within MS-Access/VBA. I want to be able to set some validation rules within the worksheet that is created and I wish to be able to set these rules from within MS-Access/VBA.

I don't know how to so this, or indeed, this can be done. All help will be much appreciated. Any other solutions will also be much appreciated.

A sample code that extracts data into a worksheet is as follows:

Dim strSQL2 as string

strSQL2 = "select * INTO [Excel 3.0;Database=" & vFullPath & "].[Original-Added]" & _
" FROM TempTbl " & _
" WHERE ucase(left(status,1)) = 'A' OR " & _
" ucase(left(status,1)) = 'O';"

DoCmd.RunSQL (strSQL2)

  • The FULL path for a file is identified in the variable called "vFullPath".
  • worksheet created is named "Original-Added".



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Access Validation rule in MS access 2010 1
Outlook MS Outlook Rules Help 2
Excel Excel VBA - attach and send .xls and .xlsx 2
Excel file extension is camouflaged as xls 1
Excel Excell .xls File Growing Fast 0
Excel Excel cannot open .xls file 0
Outlook Outlook 2003 - Out of office rules wont switch off 0
Excel Outlook rule to open Excel workbook 1