Option Group Issues

armychick86

Registered User.
Local time
Today, 13:41
Joined
Feb 11, 2007
Messages
25
I use an option group to enter information based on the whether the user chooses DHCP or Static IP Addresses. When choosing DHCP, Subnet Mask and Default gateway textboxes are disabled while IP address is enabled; when choosing Static all textboxes are enabled. That works great... to an extent.
Now for the problem...
The option chosen in one record changes all the records, for example:
DHCP is selected in Record 1, both SM and DG are disabled.
I move to record 2, Static is selected, both SM and DG are still disabled.
The textboxes stay disabled, they are not unique to the record but to the form. (I hope i explained that well enough)
Is there anyway I can fix this?

This is my code as is:
Private Sub fraIpAddress_AfterUpdate(Cancel As Integer)
If Me.fraIpAddress.Value = 1 Then
Me.txtIpAddress.Enabled = True
Me.txtSubnet.Enabled = False
Me.txtDefault.Enabled = False
Else
Me.txtIpAddress.Enabled = True
Me.txtSubnet.Enabled = True
Me.txtDefault.Enabled = True
End If
End Sub
 
It sounds like your option group is not bound to the record. The value needs to be stored within the table with the rest of the record so that the correct option comes up (and also is stored).
 
Enable/Disable

The option is stored to the table, and its not the option itself that is giving me the trouble. It's the enabled/disabled texboxes. If I change one record so they are disabled, all the records are disabled, it doesn't matter whats selected.
 
Now, what I have above prompts me to "Enter Parameter Value" every time I open the form...
The error message when I click "OK" is "Error '40036': Method 'Item' of object 'Forms' failed" If anybody has any fixes I would greatly appreciate it!

Thanks,
armychick86
 
When I unzip it, it works fine... I'll try again...
Thank you so much for replying
 
I compressed and zipped it again... I hope it works this time... On the last one I didn't have the code that was screwing it up... but i put it back this time... so thats why you'll get an error when you fisrt open it. I only entered it so you would get a better idea of my problem...

Thanks again!!!!!
 

Attachments

What are you zipping it with and what version? I keep getting this error when I try to unzip it:
Error: Device tracking database.mdb Unsupported compression method
Extracting: Device tracking database.mdb
Warning: Device tracking database.mdb failed the CRC Check
 
Okay, slowly I'm working through the issues in your database. Here are a few for you to start with and I'll keep going and post more later:

1. You manually added Cancel as Integer inside the AfterUpdate() event. You cannot do that. Form events are not user modifiable. If you want to be able to cancel something you have to use the BeforeUpdate event which does have Cancel As Integer within it.

2. In the recordset for frmMaintenance get rid of [forms]![frmDevices].[DeviceID] as criteria. Your frmMaintenance is linked via DeviceID anyway so you don't need the criteria and it is just causing problems.

3. DeviceID should be an autonumber in Device table and number (long) in other tables (not text)

4. Get rid of all DoCmd.DoMenuItem codes. You should be using DoCmd.RunCommand instead (for example DoCmd.RunCommand acCmdSaveRecord) If you use DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 that code is no longer recommended as it can vary depending on Access versions and can cause problems.

Those are just a few things and I will continue on with this and get back to you with more.
 
Thanks Bob,
If fixed the AfterUpdate it works like it did before now... i'm still working on deleting [forms]![frmDevices].[DeviceID]... as for changing the Device ID i understand why i would want it to be a number not text, and for the DoCmd.DoMenuItem codes, I used access to generate those... I thought i was saving myself time but I guess not.
Thank you very much! Your help is GREATLY appreciated.
 
I hate to be a bother but have you come up with a solution on why the disable/enable textboxes are not unique to one record but all of them?
 
Okay, next piece.

1. Change the frame (DHCP/Static) to have a default (either is fine so if you want the default to be DHCP then put one (1) in the default of the frame and if you want Static to be default put two (2) in the default so when it moves to a new record it will set it.

2. In the table, change the IP address, SubMask, and Gateway to TEXT. Numbers will not work here as they have multiple decimal points in it.
 
Last edited:
Sorry it took me so long to reply to that last post. The default value is set and all three fields are changed to text.
 

Users who are viewing this thread

Back
Top Bottom