Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Radio Buttons on Access Form

Status
Not open for further replies.

iAmSecond

MIS
Jul 10, 2015
1
US
Forgive me of my novicehood. I'm totally new to coding in VBA. I have an access form that takes 2 user inputs (CompanyName and NumberID) in addition to that I added 3 radio buttons for First name, Last name, or Neither. I created 3 different queries for the radio button selections (First name, Last name, and neither). My intent was to have the form take the 2 pieces of user input and then based on which option the user chooses it runs the corresponding query. I'll give an example and hopefully someone can help me on this.

Example:

Company Name: Fly Wheels
Number ID: 56
Selected radio button: Last Name

Based on that info now run query "Last name" that will display all the results with just a last name in the records that work for Fly Wheels with Number ID 56.


Hopefully, that makes sense as to what I'm attempting.
 
Welcome to tek-tips. What do you mean by "just a last name in the records"? Are you stating other field must be blank?

Can you provide some sample of your significant data as well as the desired output?

Option buttons as part of a frame/group have a numeric value like 1, 2, 3,...

Can you provide the SQL view of one of your queries? Having 3 different queries seems like a hassle.

Duane
Hook'D on Access
MS Access MVP
 
Normally radio buttons are used with a select case

Code:
select case my.myOptionGroup.value
  case 1
    docmd.openquery "qryOne"
  case 2
    docmd.openquery "qryTwo"
  case 3
    docmd.openquery "qryThree"
  case else
end select

I under stand this to mean that all the queries will use the same criteria. You can reference a form control value in a query. Like

Where companyName = [Forms}![YourForm].[txtCompany] and NumberID = [Forms}![YourForm].[NumberID]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top