Dachande11
Registered User.
- Local time
- Today, 19:19
- Joined
- May 1, 2001
- Messages
- 41
Hello,
I am creating quite a complicated report and need to pull some information from a query for calculation purposes. I could use the Dlookup function but this would make the report slow and since the report is run and exported 400 times for seperate customers this would compound the matter. So I have tried setting up this recordset to pass the data on within the report but I keep getting a runtime error which states "no value given for one or more required parameters".
I have pasted the code below and would be grateful for any advice as I am still very much a beginner when it comes to understanding code.
Mark
Private Sub Report_Open(Cancel As Integer)
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim Rqtr As String
Dim RqtrStart As Date
Set conn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "SELECT QtrStartEnd.Qtr, QtrStartEnd.QtrStart, QtrStartEnd.QtrEnd, QtrStartEnd.Year FROM QtrStartEnd;", conn, adOpenForwardOnly
rst.MoveFirst
Rqtr = rst![qtr]
RqtrStart = rst![qtrstart]
Me.test = RqtrStart
rst.Close
End Sub
I am creating quite a complicated report and need to pull some information from a query for calculation purposes. I could use the Dlookup function but this would make the report slow and since the report is run and exported 400 times for seperate customers this would compound the matter. So I have tried setting up this recordset to pass the data on within the report but I keep getting a runtime error which states "no value given for one or more required parameters".
I have pasted the code below and would be grateful for any advice as I am still very much a beginner when it comes to understanding code.
Mark
Private Sub Report_Open(Cancel As Integer)
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim Rqtr As String
Dim RqtrStart As Date
Set conn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "SELECT QtrStartEnd.Qtr, QtrStartEnd.QtrStart, QtrStartEnd.QtrEnd, QtrStartEnd.Year FROM QtrStartEnd;", conn, adOpenForwardOnly
rst.MoveFirst
Rqtr = rst![qtr]
RqtrStart = rst![qtrstart]
Me.test = RqtrStart
rst.Close
End Sub