Hi,
I'm having trouble with the following code. The error message is, "User defined type is not defined." I don't know what's wrong with my code...Any help is appreciated!
Private Sub Command0_Click()
Dim Conn2 As ADODB.Connection
Dim Rs1 As ADODB.Recordset
Dim SQLCode As String
Dim RptStartDate As Date
Set Conn2 = CurrentProject.Connection
Set Rs1 = New ADODB.Recordset
RptStartDate = InputBox("Enter report start date"
SQLCode = "SELECT EntitlementID, AuctionID, ZoneID, StripID, ProductID, OriginalBuyerID, CurrentHolderID, OriginalPrice, OriginalPriceUnit, BeginDate, EndDate FROM tblEntitlement WHERE BeginDate = Format(DatePart("m", RptStartDate)-1 & "/" & DatePart("d", RptStartDate) & "/" & DatePart("yyyy", RptStartDate), "Short Date""
Rs1.Open SQLCode, Conn2, adOpenStatic, adLockOptimistic
' Rs1 is going to have the results of this query or
Rs1 is the recordset.
' this little trick forces the recordset pointer to
the end
' which gets a correct count of the number of records.
Rs1.MoveLast
Rs1.MoveFirst
' so to loop through the recordset one at a time we use
a for next loop
For A = 1 To Rs1.RecordCount
'Rs1!yourfield = somevalue
'Rs1!yourfield2 = someOtherValue
''etc
Rs1.Update
Rs1.MoveNext
Next
' close it this way
Set Rs1 = Nothing
Set Conn2 = Nothing
End Sub
I'm having trouble with the following code. The error message is, "User defined type is not defined." I don't know what's wrong with my code...Any help is appreciated!
Private Sub Command0_Click()
Dim Conn2 As ADODB.Connection
Dim Rs1 As ADODB.Recordset
Dim SQLCode As String
Dim RptStartDate As Date
Set Conn2 = CurrentProject.Connection
Set Rs1 = New ADODB.Recordset
RptStartDate = InputBox("Enter report start date"
SQLCode = "SELECT EntitlementID, AuctionID, ZoneID, StripID, ProductID, OriginalBuyerID, CurrentHolderID, OriginalPrice, OriginalPriceUnit, BeginDate, EndDate FROM tblEntitlement WHERE BeginDate = Format(DatePart("m", RptStartDate)-1 & "/" & DatePart("d", RptStartDate) & "/" & DatePart("yyyy", RptStartDate), "Short Date""
Rs1.Open SQLCode, Conn2, adOpenStatic, adLockOptimistic
' Rs1 is going to have the results of this query or
Rs1 is the recordset.
' this little trick forces the recordset pointer to
the end
' which gets a correct count of the number of records.
Rs1.MoveLast
Rs1.MoveFirst
' so to loop through the recordset one at a time we use
a for next loop
For A = 1 To Rs1.RecordCount
'Rs1!yourfield = somevalue
'Rs1!yourfield2 = someOtherValue
''etc
Rs1.Update
Rs1.MoveNext
Next
' close it this way
Set Rs1 = Nothing
Set Conn2 = Nothing
End Sub