enable / disable check boxes based on combo box selection

its not that i expect it to work it just isnt and i need as basic answeris as you can give e.g. this goes here like this lol. but yh im trying to get certain tickboxes to show when i click on a combobox value.and im not sure what i am doing wrong with the code.

Code:
Public Sub ChangeSelections(varComboValue As Variant)
Dim blApplication As Boolean
Dim blSolarDecs As Boolean
Dim blMoreInfo As Boolean
Dim blTerms As Boolean

Select Case varComboValue
Case "Application Pack"
blApplication = True

Case "Solar Decs"
blSolarDecs = True

Case "More Info Required"
blMoreInfo = True

Case "Terms and Conditions"
blTerms = True

End Select

Me.Probate.Enabled = blApplication
Me.ExtensionApplication.Enabled = blApplication
Me.TansferRequest.Enabled = blApplication
Me.ChangeOfOwnership.Enabled = blApplication

Me.Appendix5.Enabled = blSolarDecs
Me.Appendix6.Enabled = blSolarDecs

Me.PhotoIdutilitybills.Enabled = blMoreInfo
Me.GenerationMeterread.Enabled = blMoreInfo
Me.Proofofpurchase.Enabled = blMoreInfo
Me.TIC.Enabled = blMoreInfo
Me.PropertyType.Enabled = blMoreInfo
Me.LastPageOfApplication.Enabled = blMoreInfo
Me.AmendMCS.Enabled = blMoreInfo
Me.MPAN.Enabled = blMoreInfo
Me.NoOfDialsOnMeter.Enabled = blMoreInfo

Me.Domestic_T_s___C_s.Enabled = blTerms
Me.Business_T_S___C_S.Enabled = blTerms
Me.Summary_Only.Enabled = blTerms
End Sub

Private Sub Letter_Requested_AfterUpdate()
ChangeSelections "Application Pack"
ChangeSelections "Solar Decs"
ChangeSelections "More Info Required"
ChangeSelections "Terms and Conditions"
End Sub
 
I can't read code in that format. Copy it from the database and re-paste it so I can see the indents. Don't copy the code you already pasted on the site. Or is that how you wrote it?
 
sorry its like this


Code:
Public Sub ChangeSelections(varComboValue As Variant)
    Dim blApplication As Boolean
    Dim blSolarDecs   As Boolean
    Dim blMoreInfo    As Boolean
    Dim blTerms       As Boolean
    
    Select Case varComboValue
        Case "Application Pack"
            blApplication = True
            
        Case "Solar Decs"
            blSolarDecs = True
            
        Case "More Info Required"
            blMoreInfo = True
            
        Case "Terms and Conditions"
            blTerms = True
        
    End Select
    
    Me.Probate.Enabled = blApplication
    Me.ExtensionApplication.Enabled = blApplication
    Me.TansferRequest.Enabled = blApplication
    Me.ChangeOfOwnership.Enabled = blApplication
    
    Me.Appendix5.Enabled = blSolarDecs
    Me.Appendix6.Enabled = blSolarDecs
    
    Me.PhotoIdutilitybills.Enabled = blMoreInfo
    Me.GenerationMeterread.Enabled = blMoreInfo
    Me.Proofofpurchase.Enabled = blMoreInfo
    Me.TIC.Enabled = blMoreInfo
    Me.PropertyType.Enabled = blMoreInfo
    Me.LastPageOfApplication.Enabled = blMoreInfo
    Me.AmendMCS.Enabled = blMoreInfo
    Me.MPAN.Enabled = blMoreInfo
    Me.NoOfDialsOnMeter.Enabled = blMoreInfo
    
    Me.Domestic_T_s___C_s.Enabled = blTerms
    Me.Business_T_S___C_S.Enabled = blTerms
    Me.Summary_Only.Enabled = blTerms
End Sub
 
Private Sub Letter_Requested_AfterUpdate()
ChangeSelections "Application Pack"
ChangeSelections "Solar Decs"
ChangeSelections "More Info Required"
ChangeSelections "Terms and Conditions"
End Sub

pasted directly from the database
 
Ok, everything looks fine except the AfterUpdate() part for Letter Requested. I've explained this as simple as possible in post #18 but I'll try one more time.

What frame is Letter_Requested related to? Application Pack, Solar Decs, More Info Required or Terms and Conditions?
 
it is the name of the combo box that contains all 4 options the other options are final confirmation, Misc but those two dont need to use the tick boxes. this is all linked to a table for a mailing database
 
Ok. Let me see the Row Source of the combo box. And if it's bound to a query, tell me the Bound field.
 
the row source is as follows
SELECT [Type of letters - for mail merge].[ID], [Type of letters - for mail merge].[Type of letter] FROM [Type of letters - for mail merge] ORDER BY [Type of letter];
thats what it choses the options then when the options are selected then the details go into mail merge table which has the following fields, agent name, customer name, correspondance address, installation address, customer reference. then all the tick boxes that are listed.
 
what do you mean what do you need a screen shot or me to send the basic files????
 
E.g.:
Code:
ID	Type of Letter
----	-------------
1	Application
2	Solar
3	More info
 
where do i get the information for the query row source on the combo box??
 
You're the developer of the database, you should know where the data is store.
 
You said this is the SQL:
Code:
SELECT [Type of letters - for mail merge].[ID], [Type of letters - for mail merge].[Type of letter] 
FROM [Type of letters - for mail merge] 
ORDER BY [Type of letter];
I then said, show me the records from that query. All you do is open the Row Source of your combo box and view it as a Datasheet. Or copy and paste that into a new query and run it.
 
oh ok sorry not good with the lingo you see im very new to access it is as follows
Code:
ID 
-----------
Application pack
Final Confirmation
Misc
More Infi Required
Solar Decs
Terms and Conditions
 
they are both the same the id are the names this was previously made by someone else but i have been given the task to amend and better it so it will be as follows:

Code:
ID 
-----------
Application pack Application pack
Final Confirmation Final Confirmation
Misc Misc
More Infi Required More Infi Required
Solar Decs Solar Decs
Terms and Conditions Terms and Conditions
 
I didn't ask you to give me the values you can see in the combobox. Copy and paste the SQL into a new query and run it. You will find that there are two fields, one ID and the other "Type of letter".
 
i did that copy and paste into a new query run it and it comes up with a table id and type of letter. both of these fields consist of the same values. the id isnt numbers its text which is the same text as the type of letter. please see attachment.
 

Attachments

  • query.PNG
    query.PNG
    81.5 KB · Views: 86
Ok, you should have included both field names in your post #37.

This is what the code should be:
Code:
Private Sub Letter_Requested_AfterUpdate()
    ChangeSelections Me.Letter_Requested.Value
End Sub
... everything else remains the same.

NB: I've been away hence the late reply.
 

Users who are viewing this thread

Back
Top Bottom