PDA

View Full Version : Solved: What's up with thes CheckBoxes and Option Boxes?



ironj32
03-02-2007, 07:51 AM
I have this Userform which when activated loads the data from a different sheet, "Saved". The "Saved" is all blank, but when the form is loaded all of the optionboxes and checkboxes are "true" and "deactivated" (atleast that is what they look like). I have attached the file if someone could take a look at it. The problem is on the third page.
Thanks!

lucas
03-02-2007, 07:57 AM
Here's a clue:
Private Sub UserForm_activate()
Dim ws As Worksheet
Set ws = Worksheets("Saved")
'Me.txtUSBManager.Value = ws.Cells(3, 1).Value
'Me.txtVendorName.Value = ws.Cells(3, 2).Value
'Me.txtContractStartDate.Value = ws.Cells(3, 3).Value
'Me.txtExpectedTerm.Value = ws.Cells(3, 4).Value
'Me.txtExpectedValue.Value = ws.Cells(3, 5).Value
'Me.cboSelectOne.Value = ws.Cells(3, 6).Value
'Me.tbxReplacedVendor.Value = ws.Cells(3, 7).Value
'Me.txtTaxID.Value = ws.Cells(3, 8).Value
'Me.txtVendorAddress.Value = ws.Cells(3, 9).Value
'Me.txtVendorCity.Value = ws.Cells(3, 10).Value
'Me.txtVendorState.Value = ws.Cells(3, 11).Value
'Me.txtVendorZip.Value = ws.Cells(3, 12).Value
'Me.txtVendorPhone.Value = ws.Cells(3, 13).Value
'Me.textVendorFax.Value = ws.Cells(3, 14).Value
'Me.textVendorWebsite.Value = ws.Cells(3, 15).Value
'Me.cboPrefix.Value = ws.Cells(3, 16).Value
'Me.txtRepFirstName.Value = ws.Cells(3, 17).Value
'Me.txtRepLastName.Value = ws.Cells(3, 18).Value
'Me.txtRepAddress.Value = ws.Cells(3, 19).Value
'Me.txtRepCity.Value = ws.Cells(3, 20).Value
'Me.txtRepState.Value = ws.Cells(3, 21).Value
'Me.txtRepZip.Value = ws.Cells(3, 22).Value
'Me.txtRepPhone.Value = ws.Cells(3, 23).Value
'Me.textRepFax.Value = ws.Cells(3, 24).Value
'Me.txtRepEmail.Value = ws.Cells(3, 25).Value
'Me.cboVendorCategory.Value = ws.Cells(3, 26).Value
'Me.tbxVendorCategoryOther.Value = ws.Cells(3, 27).Value
'Me.txtOtherContact.Value = ws.Cells(3, 28).Value
'Me.txtOtherPhone.Value = ws.Cells(3, 29).Value
'Me.txtOtherEmail.Value = ws.Cells(3, 30).Value
'Me.txtOtherVendor.Value = ws.Cells(3, 31).Value
'Me.optMissionYes.Value = ws.Cells(3, 32).Value
'Me.optMissionNo.Value = ws.Cells(3, 33).Value
'Me.tbxMissionCriticalBuildings.Value = ws.Cells(3, 34).Value
'Me.optUSBCustomerYes.Value = ws.Cells(3, 35).Value
'Me.optUSBCustomerNo.Value = ws.Cells(3, 36).Value
'Me.optMinorityOwnedYes.Value = ws.Cells(3, 37).Value
'Me.optMinorityOwnedNo.Value = ws.Cells(3, 38).Value
'Me.optSubContractorYes.Value = ws.Cells(3, 39).Value
'Me.optSubContractorNo.Value = ws.Cells(3, 40).Value
'Me.tbxSubContractor.Value = ws.Cells(3, 41).Value
'Me.chkRoutinePerfReports.Value = ws.Cells(3, 42).Value
'Me.chkStatusMeeting.Value = ws.Cells(3, 43).Value
'Me.chkContractRequirements.Value = ws.Cells(3, 44).Value
'Me.chkExceptionReport.Value = ws.Cells(3, 45).Value
'Me.chkCustomerSurvey.Value = ws.Cells(3, 46).Value
'Me.chkOther1.Value = ws.Cells(3, 47).Value
'Me.tbxVendorPerfOther.Value = ws.Cells(3, 48).Value
'Me.chkNone1.Value = ws.Cells(3, 49).Value
'Me.chkCriminal.Value = ws.Cells(3, 50).Value
'Me.chkFingerprint.Value = ws.Cells(3, 51).Value
'Me.chkBonding.Value = ws.Cells(3, 52).Value
'Me.chkDrugScreen.Value = ws.Cells(3, 53).Value
'Me.chkApplication.Value = ws.Cells(3, 54).Value
'Me.chkOther2.Value = ws.Cells(3, 55).Value
'Me.tbxPreScreenOther.Value = ws.Cells(3, 56).Value
'Me.chkNone2.Value = ws.Cells(3, 57).Value
'Me.chkPerfReports.Value = ws.Cells(3, 58).Value
'Me.chkQualityTest.Value = ws.Cells(3, 59).Value
'Me.chkAuditing.Value = ws.Cells(3, 60).Value
'Me.chkNA.Value = ws.Cells(3, 61).Value
'Me.chkOther3.Value = ws.Cells(3, 62).Value
'Me.tbxComplianceOther.Value = ws.Cells(3, 63).Value
Me.lblSurveyName = ThisWorkbook.Name
End Sub

ironj32
03-02-2007, 09:12 AM
Yeah I know. But, I want it load the users info that they have already completed and saved. Is there a different way to do this? For the checkboxes i just set them all to false. So i guess my only problem is with the option boxes.

lucas
03-02-2007, 09:23 AM
I just commented the entire initialize statement for a starting place. I think your problem is trying to give checkboxes and option buttons a range value which probably won't work:
for example:
Me.chkApplication.Value = ws.Cells(3, 54).Value

should be something like:
OptionButton2.Value = True

lucas
03-02-2007, 09:28 AM
You probably don't even want to put the option/check controls in the initialize statement unless you want them to have a default value(already selected when the form opens)

Probably better to put it in the code for the control...if true then/else..etc.
Private Sub OptionButton1_Click()

ironj32
03-02-2007, 09:43 AM
sorry i'm a little confused. i do not want them to have an initial value when they open it for the first time. The only time i want them to load the value is if the user selects a value. I want them to be able to save and close the survey, then be able to open it later and have the all the values that they had. Is this making any sense???

ironj32
03-02-2007, 09:47 AM
I think i got it...i should probably write the code so that the "Saved" sheet only is created once the saved button is clicked. Should i then maybe make a button that says "Get My Answers" which will then load the info if the user so chooses?

lucas
03-02-2007, 09:47 AM
then just remove the checkboxes and option buttons from the userform activate statment that I posted earlier.....

ironj32
03-02-2007, 10:59 AM
I am not even going to have a Userfrom activate statement. I'll just have it come up completely blank everytime. And if the user wants they load there info at the click of a button.
thanks for your thoughts and input Lucas.

Bob Phillips
03-02-2007, 11:09 AM
It will work. It is the initial state that is the problem, so just check it



If ws.Cells(3, 42).Value <> "" Then Me.chkRoutinePerfReports.Value = ws.Cells(3, 42).Value