iankerry
Registered User.
- Local time
- Today, 18:18
- Joined
- Aug 10, 2005
- Messages
- 190
Hi All, have been scratching more than my head about this one for sometime. hope i can explain it properly.
i have a database with 1000 records on it. on a form i will have a filter on which shows me all the events coming up for one venue.
i have a button which if pressed generates an email, with a list of all the bookings for that venue, so i can send it by way of confirmation. This has worked well for years!
but now for some reason, the code misses out one record...e.g. it generates an email without one of the bookings for that venue in it.
I turned the SQL statement in the code into a query in Access and in the SQL server, and they both include the missing record. What on earth can be going wrong?
I hope that is understandable. Forgive me i am not a great programmer and have built this system up over many years!
thanks for any clues.
ian
i have a database with 1000 records on it. on a form i will have a filter on which shows me all the events coming up for one venue.
i have a button which if pressed generates an email, with a list of all the bookings for that venue, so i can send it by way of confirmation. This has worked well for years!
but now for some reason, the code misses out one record...e.g. it generates an email without one of the bookings for that venue in it.
I turned the SQL statement in the code into a query in Access and in the SQL server, and they both include the missing record. What on earth can be going wrong?
Code:
Private Sub cmdEmail_Click()
Dim arrSummaryData() As SUMMARY_DATA
Dim SQL As String
Dim strEmail As String
Dim strTime As String
Dim strPromoterName As String
Dim intRecordCount As Integer
Dim dblRecord As Double
Dim i As Integer
Dim lngPromoterId As Long
Dim StrSpEvent As String
Dim strDVD As String
Dim strposter As String
Dim curAdultTP As Currency
'Dim tmpowndvd1 As String
If IsNull(Me.PromoterID.Value) Then
lngPromoterId = 0
Else
lngPromoterId = Me.PromoterID.Value
End If
intRecordCount = 0
strPromoterName = ""
strEmail = ""
SQL = ""
SQL = "SELECT [poster notes], EventsFlicks.cluster, EventsFlicks.specialevents, EventsFlicks.datefield, Films.[film name], EventsFlicks.owndvd, EventsFlicks.time, EventsFlicks.AdultTP, EventsFlicks.FamilyTP, EventsFlicks.ChildTP, EventsFlicks.other1TP,Venues.VENUE, Promoters.NAME,Promoters.email, Promoters.ID" & _
" FROM (Films INNER JOIN filmCopies ON Films.ID = filmCopies.tblFilms_ID) INNER JOIN (Venues INNER JOIN (Promoters INNER JOIN EventsFlicks ON Promoters.ID = EventsFlicks.promoterID) ON Venues.ID = EventsFlicks.venueID) ON filmCopies.ID = EventsFlicks.filmCopyID " & _
" WHERE (((EventsFlicks.datefield) > GetDate()) And ((Promoters.ID) = " & lngPromoterId & "))" & _
" ORDER BY EventsFlicks.datefield"
If OpenConnection Then
If rs.State = adStateOpen Then rs.Close
rs.Open SQL, cn, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then
dblRecord = rs.RecordCount
ReDim arrSummaryData(1 To dblRecord)
'create an Array depends on number of records and put all data with features
'
With rs
intRecordCount = 1
Do While Not .EOF
arrSummaryData(intRecordCount).strPromoterName = IIf(IsNull(![NAME]), "", ![NAME])
strPromoterName = arrSummaryData(intRecordCount).strPromoterName
arrSummaryData(intRecordCount).strEmail = IIf(IsNull(![email]), "", ![email])
strEmail = arrSummaryData(intRecordCount).strEmail
arrSummaryData(intRecordCount).dtDatefield = IIf(IsNull(![datefield]), "", ![datefield])
arrSummaryData(intRecordCount).strTime = IIf(IsNull(![time]), "", ![time])
arrSummaryData(intRecordCount).strDVD = IIf(IsNull(![owndvd]), "", ![owndvd])
If arrSummaryData(intRecordCount).strDVD = "False" Then
arrSummaryData(intRecordCount).strDVD = "We will provide the DVD for this screening"
Else
arrSummaryData(intRecordCount).strDVD = "You will provide your own DVD"
End If
arrSummaryData(intRecordCount).strFilmName = IIf(IsNull(![film name]), "", ![film name])
arrSummaryData(intRecordCount).strVenue = IIf(IsNull(![VENUE]), "", ![VENUE])
arrSummaryData(intRecordCount).curAdultTP = IIf(IsNull(![AdultTP]), "", ![AdultTP])
arrSummaryData(intRecordCount).curChildTP = IIf(IsNull(![ChildTP]), "", ![ChildTP])
arrSummaryData(intRecordCount).curFamilyTP = IIf(IsNull(![FamilyTP]), "", ![FamilyTP])
arrSummaryData(intRecordCount).curother1tp = IIf(IsNull(![Other1TP]), "", ![Other1TP])
' If specialevents = Null Then
' specialevents = "not applicable"
' Else
arrSummaryData(intRecordCount).StrSpEvent = IIf(IsNull(![specialevents]), "", ![specialevents])
' End If
arrSummaryData(intRecordCount).strposter = IIf(IsNull(![poster notes]), "", ![poster notes])
.MoveNext
intRecordCount = intRecordCount + 1
Loop
.Close
End With
Dim strmessage As String
strmessage = "Dear " & strPromoterName & "," & vbCrLf & vbCrLf & "Below are your requested bookings - please check ALL the details:" & vbCrLf
I hope that is understandable. Forgive me i am not a great programmer and have built this system up over many years!
thanks for any clues.
ian