473,465 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

copying data from query into a form

1 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. Public Sub DuplicatePlan()
  2.  
  3. Set qdefPold = CurrentDb.CreateQueryDef("SELECT * FROM RiderEntry WHERE FACTSPlanName=Forms!Group!Rates.Form.PickPlan")
  4. Set rstPold = qdefPold.OpenRecordset
  5.  
  6. Set qdefPnew = CurrentDb.CreateQueryDef("SELECT Rates * FROM Rates WHERE grID=Forms!Group!gID")
  7. Set rstAnew = qdefAnew.OpenRecordset
  8.  
  9. With rstPnew
  10.  
  11.     .AddNew
  12.  
  13.     !RM1Rider = rstPold!M3Rider
  14.     !rARider = rstPold!ARider
  15.     !rBRider = rstPold!BRider
  16.     !rCRider = rstPold!CRider
  17.     !rDRider = rstPold!Drider
  18.     !rERider = rstPold!ERider
  19.     !rDPRider = rstPold!DPRider
  20.     !rEPRider = rstPold!EPRider
  21.     !rGRider = rstPold!GRider
  22.     !rHRider = rstPold!H1Rider
  23.     !rJRider = rstPold!JRider
  24.     !rKRider = rstPold!KRider
  25.     !rLRider = rstPold!LRider
  26.     !rNRider = rstPold!NRider
  27.     !rPRider = rstPold!PRider
  28.     !rQRider = rstPold!QRider
  29.     !rFRider = rstPold!FRider
  30.     !rFRiderDed = rstPold!F15Rider
  31.  
  32.     .Update
  33.     .MoveLast
  34.     .Close
  35. End With
  36. rstPold.Close
  37. Set qdefPold = Nothing
  38. Set rstPold = Nothing
  39.  
  40. Set qdefPnew = Nothing
  41. Set rstPnew = Nothing
  42.  
  43.  
  44. End Sub
  45.  
Needless to say, it doesn't work! :)

Thank you,

Kelly
Oct 25 '10 #1
2 1522
malcolmk
79 New Member
do you mean that when you pick a plan name from a drop down box you want the plan details to appear on the form? Or you want the customer details appended to a table listing customer and what plan they are on ?
Nov 13 '10 #2
NeoPa
32,556 Recognized Expert Moderator MVP
Kelly, you need to have a rethink of how these things work in Access. It's actually a lot simpler than you're making it.

A ComboBox control has a Row Source property, where you define the data that populates the control, and a Control Source property, to specify which field in the form's bound table the data is stored to when the record is saved.
Nov 15 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike Cocker | last post by:
Hello, I'm quite weak at PHP, so I was hoping to get some help understanding the below code. First off, I'm trying to create a "query form" that will allow me to display the results on my...
5
by: Thomas Lotze | last post by:
Hi, another question: What's the most efficient way of copying data between two file-like objects? f1.write(f2.read()) doesn't seem to me as efficient as it might be, as a string containing...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
2
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5...
4
by: intl04 | last post by:
How do I create a data input form in Access that is external to the Access database to which it's connected (if that's possible, which I believe it is)? For example, if someone clicks on an Access...
1
by: Dman | last post by:
MS Access 2002 - query form control returns funny symbols like I am running an append query on a form. Access is having trouble with the calculated fields and comboboxes. Example – referring...
6
by: beowulfs | last post by:
Here's what I've got: I've got a form with combo boxes. you can select already existing company names or type in new ones. if you type in a new one, it prompts you to double click the combo...
1
by: Alex.Wisnoski | last post by:
I have a data entry form with a combo box to look up an entrant's name. If the name is already in the table then it pulls up the record and that part of the form works fine. If the name isn't in...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
2
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.