Hi,
I have a form which will have 4 text boxes where user will type ID,Version,Channel,Date and hit a search button which should open a form for instance "frmEmail" which is already in my database, but it should change the Recordsource query for form "frmEmail" based on my search creiteria.
Currently my code is
Dim SqlEl As String
Dim SqlPs As String
Dim SqlMl As String
If (Me.Text4.Value = "EMAIL"
Then
SqlEl = "SELECT DISTINCT CampaignID, CampaignVersion, CampaignName, DeliveryChannel, TDNumber, InHomeDate, Notes FROM tblCouponMaintain WHERE DeliveryChannel in('EMAIL') and CampaignID=" & """" & Me.Text0.Value & """" & " and CampaignVersion=" & """" & Me.Text2.Value & """" & " and InHomeDate=" & "#" & Me.Text6.Value & "#"
Forms!frmEmail.RecordSource = SqlEl
Else
If (Me.Text4.Value = "POS"
Then
SqlPs = "SELECT DISTINCT tblCouponMaintain.CampaignID, tblCouponMaintain.CampaignVersion, tblCouponMaintain.CampaignName, tblCouponMaintain.DeliveryChannel, tblCouponMaintain.TDNumber, tblCouponMaintain.InHomeDate, tblCouponMaintain.Notes FROM tblCouponMaintain WHERE tblCouponMaintain.DeliveryChannel In ('POS')"
Forms!frmPos.RecordSource = SqlPs
Else
If (Me.Text4.Value = "MAIL"
Then
SqlMl = "SELECT DISTINCT tblCouponMaintain.CampaignID, tblCouponMaintain.CampaignVersion, tblCouponMaintain.DeliveryChannel, tblCouponMaintain.TDNumber, tblCouponMaintain.CampaignName, tblCouponMaintain.InHomeDate, tblCouponMaintain.Notes FROM tblCouponMaintain WHERE tblCouponMaintain.DeliveryChannel in('MAIL')"
Forms!frmMail.RecordSource = SqlMl
End If
End If
End If
But its giving me error at this following line. H
Forms!frmPos.RecordSource = SqlPs
How to slove this?
I have a form which will have 4 text boxes where user will type ID,Version,Channel,Date and hit a search button which should open a form for instance "frmEmail" which is already in my database, but it should change the Recordsource query for form "frmEmail" based on my search creiteria.
Currently my code is
Dim SqlEl As String
Dim SqlPs As String
Dim SqlMl As String
If (Me.Text4.Value = "EMAIL"
SqlEl = "SELECT DISTINCT CampaignID, CampaignVersion, CampaignName, DeliveryChannel, TDNumber, InHomeDate, Notes FROM tblCouponMaintain WHERE DeliveryChannel in('EMAIL') and CampaignID=" & """" & Me.Text0.Value & """" & " and CampaignVersion=" & """" & Me.Text2.Value & """" & " and InHomeDate=" & "#" & Me.Text6.Value & "#"
Forms!frmEmail.RecordSource = SqlEl
Else
If (Me.Text4.Value = "POS"
SqlPs = "SELECT DISTINCT tblCouponMaintain.CampaignID, tblCouponMaintain.CampaignVersion, tblCouponMaintain.CampaignName, tblCouponMaintain.DeliveryChannel, tblCouponMaintain.TDNumber, tblCouponMaintain.InHomeDate, tblCouponMaintain.Notes FROM tblCouponMaintain WHERE tblCouponMaintain.DeliveryChannel In ('POS')"
Forms!frmPos.RecordSource = SqlPs
Else
If (Me.Text4.Value = "MAIL"
SqlMl = "SELECT DISTINCT tblCouponMaintain.CampaignID, tblCouponMaintain.CampaignVersion, tblCouponMaintain.DeliveryChannel, tblCouponMaintain.TDNumber, tblCouponMaintain.CampaignName, tblCouponMaintain.InHomeDate, tblCouponMaintain.Notes FROM tblCouponMaintain WHERE tblCouponMaintain.DeliveryChannel in('MAIL')"
Forms!frmMail.RecordSource = SqlMl
End If
End If
End If
But its giving me error at this following line. H
Forms!frmPos.RecordSource = SqlPs
How to slove this?