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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Buttons to perform Actions? 1

Status
Not open for further replies.

bjm027

MIS
Mar 7, 2003
59
US
I have an option group with three options. I also have a table structure in which I want one of these options to automatically add certain fields to this structure from the form in which the option group is located.
I have already created an append query to connect the fields from my table to the structure, but when new data is entered I want the option, when selected, to add the data the structure for me.

My options are:
-Add to Mailing Database (which is a separate database from the one I'm working on)
-Already in Mailing Database
-Neither

I know, I don’t like the options either and think it could be easier a different way, but my supervisor wants it that way.
I hope there is enough information for a reply. I imagine there is coding for the option group in the AfterUpdate Event. But I am not sure and new at this.

Thanks in advance.
 
The option group itself will be set to the VALUE of which ever individual option within it is chosen. For example, if you have three radio buttons, values 1, 2 or 3, and you choose the button for option #2, the option group ITSELF will be set to "2".

So your code needs to be attached to the AfterUpdate event of the Option Group (frame) itself, looking something like this:


Public Sub MyFrame_AfterUpdate

Select case MyFrame
case 1
do this stuff
case 2
do this other stuff instead
case 3
or do this stuff instead
end select

end sub


Got the picture?






Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Yes, I understand that logic behind it. But I guess that my weakness is in getting the logic behind the "do this stuff" code.
In this instance Case 2 and 3 do nothing. Its just there for viewing purposes.
Case 1 is going to add certain fields to the structure I mentioned earlier (ex. FirstName, LastName, etc.).

I don’t know if the structure will cause a problem since it is appended to a table in my database?

If you can help it would be much appreciated.
 
A similar type question. Seems easy, but I can't get it to work. If I set up an option box and a date box next to it.... I want the date to be automatically entered when the option box is checked. I have 5 of these lines on the one page, set up to track the status of a customer. EX:

Option box-first contact Date
Option box-follow up call Date
Option box-appointment set Date
Option box-application filled Date
Option box-account opened Date

I want the date box filled automatically with the current date when the option box is checked

I am VERY new at this and would appreciate any help!
 
Sara, I'm not convinced that five option boxes and five text boxes for dates are the way to go here.

In the long run, why not just use the five date fields - on the day of First Contact, you fill in today's date (or whatever). And so on down the line for the other milestones.

Logically, the presence of a non-null date value indicates that that "event" has occured.

In other words, why bother saving the "YES, this event has occured" and the "It occured on THIS date" information, when just the "It occured on this date" indicates the same information.

Don't make your system more complex than it needs to be.

Jim

Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
BJM027, I think we have a slight misunderstanding of concepts here. You say you want to ADD FIELDS to your structure, but it sounds more like you want to add RECORDS to a table ??? This is what append queries do.

IF this is so, then your option group logic will add this line:

Docmd.OpenQuery "MyAppendQuery"

with "myAppendQuery" being substituted with the actual name of your append query, that you say is already written.

Does this help?

Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
WildHare,
You are right. I was thinking about the idea the wrong way. What I did for now is added the field of the option group to my append query and for the criteria I put 'Like "1"'. Since the value of the option I want to perform the action "Add to Mailing Database" is 1.
I started off thinking to complicated about the logic behind this. I wanted the option group to do more than my supervisor was looking for. Now when I run the query it filters those records with the value of 1 assigned to it.
Anyways, thanks for you help. Much appreciated.
If you see somthing wrong with this let me know.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top