exporting data to MS Project

G

Guest

I have to fix the procedure to export data to MS Project. In the code below:

===============================

Option Compare Database
Option Explicit

Sub ReportToProject(Optional lngGroupID As Long, Optional lngSubGroupID As
Long)
Dim cnn As Object
Dim rsExport As Object, rsExportRes As Object
Dim pj As Object, apj As Object
Dim intCounter As Integer, lngTotalRecords As Long
Dim strProjectName As String, strPath As String
Dim strCurrentAsset As String, intCreateproject As Integer
Dim strGroupName As String
Dim blnExists As Boolean

MsgBox "started the function"
MsgBox "GroupID = " & lngGroupID
MsgBox "SubGroupID = " & lngSubGroupID

On Error GoTo Err_ReportToProject

'set variables
Set cnn = CurrentProject.Connection
Set rsExport = CreateObject("ADODB.Recordset")
Set rsExportRes = CreateObject("ADODB.Recordset")

If lngGroupID = 0 Then
rsExport.Open "SELECT * FROM qryExportToProject1", cnn, 1
rsExportRes.Open "SELECT * FROM qryExportResources", cnn, 1
Else
If lngSubGroupID = 0 Then
rsExport.Open "SELECT * FROM qryExportToProject1 WHERE
lngGeneralGroupsID = " & lngGroupID, cnn, 1
rsExportRes.Open "SELECT * FROM qryExportResources WHERE
[tblGeneralGroups].[lngGeneralGroupsID] = " & lngGroupID, cnn, 1
Else
rsExport.Open "SELECT * FROM qryExportToProject1 WHERE
lngAssetGroupID = " & lngSubGroupID, cnn, 1
rsExportRes.Open "SELECT * FROM qryExportResources WHERE
lngAssetGroupID = " & lngSubGroupID, cnn, 1
End If
End If
.......
==========================

I am getting an eror:

-2147217904 when the process is reaching the If area.

Queries - qryExportToProject and qryExportResources are working fine.
Parameters are passed to the module itself. What parameters are missing in my
IF statements ?

Thanks for help.

Regards,

Tony
 
G

Guest

I have not provided correct details for error message. It is:

-2147217904: No value given for one or more required parameters.

I hope this may help.

Tony
 

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

Top