I have read in one of the forums how to create system dsn through VB codings. But it is not working with Microsoft Access DB. It is creating a DSN with name MyDsn but it is not mapping it to the database. Please help as fast as possible. Coding is as follows

Private Declare Function SQLConfigDataSource Lib "ODBCCP32" _
(ByVal nHwndParent As Long, _
ByVal nRequest As Long, _
ByVal cDriver As String, _
ByVal cAttributes As String) As Long

Private Const ODBC_ADD_DSN = 1
Private Const ODBC_CONFIG_DSN = 2
Private Const ODBC_REMOVE_DSN = 3
Private Const ODBC_ADD_SYS_DSN = 4
Private Const ODBC_CONFIG_SYS_DSN = 5
Private Const ODBC_REMOVE_SYS_DSN = 6

Private Sub CreateVFPDSN(ByVal sDSN As String, sDescription As String, ByVal sDB As String)

' Make sure DSN Exists, (creates one if not already there)
Call SQLConfigDataSource(0, ODBC_ADD_SYS_DSN, _
"Microsoft Access Driver (*.mdb)", _
"DSN=" & sDSN & Chr(0) & _
"DESCRIPTION=" & sDescription & Chr(0) & _
"SOURCETYPE=DBC" & Chr(0) & _
"SOURCEDB=" & sDB & Chr(0) & _
" BACKGROUNDFETCH=NO" & Chr(0) & _
"NULL=YES" & Chr(0) & _
"DELETED=YES" & Chr(0) & _
"EXCLUSIVE=NO" & Chr(0) & Chr(0))

' Make sure DSN points to right Data Source DBC
Call SQLConfigDataSource(0, ODBC_CONFIG_SYS_DSN, _
"Microsoft Access Driver (*.mdb)", _
"DSN=" & sDSN & Chr(0) & _
"SOURCEDB=" & sDB & Chr(0) & _
Chr(0))
End Sub

Private Sub Command1_Click()
Call CreateVFPDSN( _
"MyDsn", _
"Example of creating a DSN at runtime through VB.", _
"C:\xyz.mdb")
End Sub