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

Joined
Aug 11, 2010
Messages
1
Reaction score
0
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)

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

Amin
 
Back
Top