M
Mike Collard
MS offer an explanation of the above error but it doesn't
work for me.
I get the error when trying to run the folowing:
Sub SaveChangedMarkerPrices(strGrade As String, strType As
String, dblCurrentMarkerPrice As Double, ctlMarkerPrice As
Control)
Dim dbsA As Database, rstA As Recordset
Dim frmA As Form
Dim strSql As String
Dim lngMkCat As Long
DoCmd.SetWarnings False
Set frmA = [Forms]![Pricing Screen]
If IsNull(DMax("[MK_CAT]", "Current Marker
Prices", "[GRADE] = " & "'" & strGrade & "' and [TYPE] = "
& "'" & strType & "' ")) Then Exit Sub
lngMkCat = DMax("[MK_CAT]", "Current Marker
Prices", "[GRADE] = " & "'" & strGrade & "' and [TYPE] = "
& "'" & strType & "' ")
strSql = "SELECT * from [Competitor Prices] WHERE [MK_CAT]
= " & lngMkCat & " AND [GRADE] = " & "'" & strGrade & "'
AND [TYPE] = " & "'" & strType & "' AND [INACTIVE_DATE] IS
NULL"
Set dbsA = CurrentDb
Set rstA = dbsA.OpenRecordset(strSql, dbOpenDynaset)
If dblCurrentMarkerPrice <> ctlMarkerPrice Then
datCurrentTimeStamp = DMax
("[TIME_STAMP]", "Current Marker Prices", "[GRADE] = "
& "'" & strGrade & "' AND [TYPE] = " & "'" & strType
& "' ")
If datCurrentTimeStamp > Date And
datCurrentTimeStamp <= Date + 1 Then
With rstA
.MoveFirst
.Edit
!MK_CAT = lngMkCat
!GRADE = strGrade
!Type = strType
!PRICE_PPL = ctlMarkerPrice
!EFFECTIVE_DATE = frmA.EffectiveDate
!TIME_STAMP = Date + Time
.Update
End With
Else
With rstA
.MoveFirst
.Edit
!INACTIVE_DATE = frmA.EffectiveDate
.Update
.AddNew
!MK_CAT = lngMkCat
!GRADE = strGrade
!PRICE_PPL = ctlMarkerPrice
!EFFECTIVE_DATE = frmA.EffectiveDate
!TIME_STAMP = Date + Time
.Update
End With
End If
End If
DoCmd.SetWarnings True
End Sub
***********************************************
Any ideas?
work for me.
I get the error when trying to run the folowing:
Sub SaveChangedMarkerPrices(strGrade As String, strType As
String, dblCurrentMarkerPrice As Double, ctlMarkerPrice As
Control)
Dim dbsA As Database, rstA As Recordset
Dim frmA As Form
Dim strSql As String
Dim lngMkCat As Long
DoCmd.SetWarnings False
Set frmA = [Forms]![Pricing Screen]
If IsNull(DMax("[MK_CAT]", "Current Marker
Prices", "[GRADE] = " & "'" & strGrade & "' and [TYPE] = "
& "'" & strType & "' ")) Then Exit Sub
lngMkCat = DMax("[MK_CAT]", "Current Marker
Prices", "[GRADE] = " & "'" & strGrade & "' and [TYPE] = "
& "'" & strType & "' ")
strSql = "SELECT * from [Competitor Prices] WHERE [MK_CAT]
= " & lngMkCat & " AND [GRADE] = " & "'" & strGrade & "'
AND [TYPE] = " & "'" & strType & "' AND [INACTIVE_DATE] IS
NULL"
Set dbsA = CurrentDb
Set rstA = dbsA.OpenRecordset(strSql, dbOpenDynaset)
If dblCurrentMarkerPrice <> ctlMarkerPrice Then
datCurrentTimeStamp = DMax
("[TIME_STAMP]", "Current Marker Prices", "[GRADE] = "
& "'" & strGrade & "' AND [TYPE] = " & "'" & strType
& "' ")
If datCurrentTimeStamp > Date And
datCurrentTimeStamp <= Date + 1 Then
With rstA
.MoveFirst
.Edit
!MK_CAT = lngMkCat
!GRADE = strGrade
!Type = strType
!PRICE_PPL = ctlMarkerPrice
!EFFECTIVE_DATE = frmA.EffectiveDate
!TIME_STAMP = Date + Time
.Update
End With
Else
With rstA
.MoveFirst
.Edit
!INACTIVE_DATE = frmA.EffectiveDate
.Update
.AddNew
!MK_CAT = lngMkCat
!GRADE = strGrade
!PRICE_PPL = ctlMarkerPrice
!EFFECTIVE_DATE = frmA.EffectiveDate
!TIME_STAMP = Date + Time
.Update
End With
End If
End If
DoCmd.SetWarnings True
End Sub
***********************************************
Any ideas?