I am trying to get information from a query and paste it into my form. I have a table called Plans that has insurance plans that we currently offer. When we have a new group that we are quoting, I want to be able to choose a dropdown box, pick a plan and have it update the table attached to my form. Is this possible? I've looked all over the internet for code, and nothing seems to be working for me. Here is the code I have so far, not even sure this will work, but it will give you an idea on what I'm trying to do:
Needless to say, it doesn't work! :)
Thank you,
Kelly
Code:
Public Sub DuplicatePlan()
Set qdefPold = CurrentDb.CreateQueryDef("SELECT * FROM RiderEntry WHERE FACTSPlanName=Forms!Group!Rates.Form.PickPlan")
Set rstPold = qdefPold.OpenRecordset
Set qdefPnew = CurrentDb.CreateQueryDef("SELECT Rates * FROM Rates WHERE grID=Forms!Group!gID")
Set rstAnew = qdefAnew.OpenRecordset
With rstPnew
.AddNew
!RM1Rider = rstPold!M3Rider
!rARider = rstPold!ARider
!rBRider = rstPold!BRider
!rCRider = rstPold!CRider
!rDRider = rstPold!Drider
!rERider = rstPold!ERider
!rDPRider = rstPold!DPRider
!rEPRider = rstPold!EPRider
!rGRider = rstPold!GRider
!rHRider = rstPold!H1Rider
!rJRider = rstPold!JRider
!rKRider = rstPold!KRider
!rLRider = rstPold!LRider
!rNRider = rstPold!NRider
!rPRider = rstPold!PRider
!rQRider = rstPold!QRider
!rFRider = rstPold!FRider
!rFRiderDed = rstPold!F15Rider
.Update
.MoveLast
.Close
End With
rstPold.Close
Set qdefPold = Nothing
Set rstPold = Nothing
Set qdefPnew = Nothing
Set rstPnew = Nothing
End Sub
Thank you,
Kelly
Comment