473,378 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Calling an option group from a subform using ADO

2
Hello!

Here is the code I'm working with:
Expand|Select|Wrap|Line Numbers
  1. Private Sub opbAddNew_Click()
  2.  
  3. Dim rstRiskRating As ADODB.Recordset
  4. Set rstRiskRating = New ADODB.Recordset
  5.  
  6. With rstRiskRating
  7.     .ActiveConnection = CurrentProject.Connection
  8.     .CursorType = adOpenKeyset
  9.     .LockType = adLockOptimistic
  10.     .Open "Select * from tblRiskRating"
  11.     .AddNew
  12.         !PropertyID = Forms!frmNewRiskRating.txtPropertyID
  13.         !ValidDate = Forms!frmNewRiskRating.txtValidDate
  14.         !Operational = Me!sfrmSponMgmt.optOperational
  15.     .Update
  16. End With
  17.  
  18. rstRiskRating.Close
  19. Set rstRiskRating = Nothing
  20.  
  21. DoCmd.Close
  22.  
  23. End Sub
The line in bold is intended to populate the field [Operational] in a table. This is an option group (valued 1 through 5) called "optOperational" on subform "sfrmSponMgmt."

My problem is simple, I can't seem to find the correct syntax to link the option group selection to the value to be added to the table. Is my syntax wrong? Or is there some trick to fetching a value from an option group that I'm unaware of?

Any help would be greatly appreciated.

Thanks,

Michael
Feb 22 '08 #1
2 1472
mmath
2
Never mind. I solved the problem by replacing the bolded line with this:

!Operational = Form_frmNewRiskRating.sfrmSponMgmt.Controls(optOpe rational)

Thank you.
Feb 22 '08 #2
NeoPa
32,556 Expert Mod 16PB
Thanks for posting back with the solution.
Feb 26 '08 #3

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

Similar topics

2
by: Phil Matish | last post by:
I would like to know if the following is possible: I have a form and a subform. In the subform, there are records summarized. (For ex, instead of showing all 19 fields, I only show 3 to save...
5
by: William Wisnieski | last post by:
Hello Everyone, I have a query by form with several list boxes. The user selects items from the list boxes and clicks a button that returns results in a datasheet subform. One of the list...
5
by: | last post by:
Hi guys, I have a form that I am using option groups on.. how can i make each option group a multi select ? thanks, kevin
3
by: jburris | last post by:
I have been through enough of these threads to think that this should be an easy fix... but, are there circumstances in which the following code syntax does not work? =!!.Form! (this is out of...
0
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. ...
1
by: Moe | last post by:
Hi, this my first post to this group. I am trying to add a option group of ture/false and all. This is on a form, that the results are displayed in a subform. When the user select a record from...
3
by: Danny J. Lesandrini | last post by:
-- previously posted on newsgroup :: <microsoft.public.access-- Has anyone else noticed this behavior? Focus jumping from current cell to upper left in embedded datasheet. If not, would you be...
4
by: JHite | last post by:
I am using Access 2003 on Windows XP. This is a simple database that contains “tblStaffers” containing names of the office staffers, “tblProjects” containing names of the office projects, and...
21
jinalpatel
by: jinalpatel | last post by:
I have three option buttons (1 option group): construction projects, non construction projects and aquisition projects. I have created a form with more than 35 data entry fields for each of this...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.