Results 1 to 14 of 14
  1. #1
    kyleeb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    7

    Highlighting Help!!

    I am new to Access and urgently need help.

    I have put together a form in Access which has a number of questions. Each question is answered by choosing a button (0 through 4), all of which are required. If the person taking the form leaves a question blank and tries to save the form, a customized message pops up that tells them they cannot continue and must go back and finish answering all the questions.



    What I desperately need help with is making these null answers visible to the form-taker. I need the answers that have been skipped over to be highlighted in yellow for easy identification. Can anyone help me with this??

    Thank you,

    Kylee

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    kyleeb -

    If the results (which button was clicked) are stored in a textbox control, you should be able to use conditional formatting. Right click on the textbox while in design view, then select conditional formatting, under condition 1, select "expression is", put: IsNull([NameofTextboxcontrol])= True, next choose the paint/fill icon and select color. Repeat for each control. Save and test.

    If the results are not being stored in a textbox, post back with where/how the results are being stored.

    Hope this gets you started,

    Jim

  3. #3
    kyleeb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    7
    Hi Jim, thanks so much for your response. Unfortunately they are not in a textbox control and I cannot use conditional formatting. The form control Option Group was used with radial buttons 0 through 4. This is pretty much a simple survey, similar to ones you see on common websites.
    Does that help?
    Kylee



    Quote Originally Posted by ketbdnetbp View Post
    kyleeb -

    If the results (which button was clicked) are stored in a textbox control, you should be able to use conditional formatting. Right click on the textbox while in design view, then select conditional formatting, under condition 1, select "expression is", put: IsNull([NameofTextboxcontrol])= True, next choose the paint/fill icon and select color. Repeat for each control. Save and test.

    If the results are not being stored in a textbox, post back with where/how the results are being stored.

    Hope this gets you started,

    Jim

  4. #4
    kyleeb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    7
    Click image for larger version. 

Name:	untitled.JPG 
Views:	9 
Size:	78.2 KB 
ID:	10824

    Here is a screenshot of page 2 of the survey. Hope this helps with my explanation.

  5. #5
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    kyleeb -

    Are "Headaches", "Feelings of dizziness", etc. labels for the option groups?

    Also, can you provide a screen shot of the form in design view and a screen shot of the underlying table in design view?

    Depending upon how the form was setup, there might be a few options from which to choose that will satisfy your requirement.

    All the best,

    Jim

  6. #6
    kyleeb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    7
    Jim-

    Yes, "Headaches", "Feelings of dizziness", etc are labels for the option groups.

    The first screen shot is the form in design view and the second is the table in design view.
    Attached Thumbnails Attached Thumbnails untitled2.jpg   untitled3.JPG  

  7. #7
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    kyleeb -

    Thanks for sending the requested info. However, I have weekend plans, so I won't be able respond in detail until the beginning of next week.

    Thanks,

    Jim

  8. #8
    alcapps is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    292
    below is the click event of a button

    use this in your save or move next button..
    replace the frame1 with the frames that you created.
    replace the label12 with the labels for each frame you created.

    This turns the labels red if the value is null otherwise it is black.

    also just keep adding if then else for as many option boxes you have. If you had more than 4 I would show you in code how to make this spin threw all your option boxes so that it would be easier to maintain. but for 4 just add 4 if then else statements should be fine.


    Private Sub btnSave_Click()
    On Error GoTo Err_btnSave_Click


    If Nz(Me.Frame1, 0) = 0 Then
    Me.Label12.ForeColor = 255
    Else
    Me.Label12.ForeColor = 0
    End If
    If Nz(Me.Frame2, 0) = 0 Then
    Me.Label23.ForeColor = 255
    Else
    Me.Label23.ForeColor = 0
    End If

    Exit_btnSave_Click:
    Exit Sub

    Err_btnSave_Click:
    MsgBox Err.Description
    Resume Exit_btnSave_Click

    End Sub

    hopes this helps..

  9. #9
    kyleeb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    7
    alcapps -

    Thank you so much for your help.

    Do you mind expanding on what you mean by replacing the frame1 with the frames i created? and also the next part of replacing the label12 with the labels i created?

    thank you!

  10. #10
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    Sure,
    Frame1 refers to the option frame. Each question refers to a frame and each frame has it's own label. The code I gave you let's you set the color of the label based on no selection in that question when you go to save.

    Hope this helps

  11. #11
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    kyleeb -

    There are a number of ways to accomplish your goals, only limited by your imagination. As I indicated late last week, I have attached a rudimentary db that shows some simple manipulation of the controls (option groups, labels, showing and hiding pictures, etc.). In each case, VBA is used to set and re-set various control properties which, in turn, determines how they are displayed. For my purposes, I named each option group as OG and added a number that corresponds to the question number. Also, the option group labels were named using a similiar convention (LOG) & #, as were the pictures. With each question (Option group) the TAG property was set to equal the question number. Lastly, I created an array in which the value of each element (question/option group) was set to 1 if the question was answered, 0 if otherwise. The array was read/used to enable/disable the next page button.

    I hope this gets you started.

    All the best, Jim
    Attached Files Attached Files

  12. #12
    kyleeb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    7
    Jim- I really appreciate your help.
    Like I said, I am very new to access so I am a little confused on this. When I open db2, I see a table. This is all that is supposed to be there, is that correct? From what I am reading it seems like there should be a form as well?

  13. #13
    kyleeb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    7
    I think I just answered my own question I am going to play around with this. Thanks again Jim.

  14. #14
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    kyleeb,
    in the example that ketbdnetdb did..

    if you look at OG1 object or the first question about the head.. that is the same as

    me.frame1 = me.og1
    me.label12 = me.log1
    and so on..


    Private Sub btnSave_Click()

    On Error GoTo Err_btnSave_Click

    '-----------
    'put code below in a button click event for your form to save or check for validation...
    ' replace me.frame1 to the option box control name like in the form me.og1
    ' replace me.label12 to the label of the option box control name like me.log1 in the form.
    'keep adding option boxes for the number of questions you have.
    '-----------
    'option box 1
    If Nz(Me.Frame1, 0) = 0 Then

    Me.Label12.ForeColor = 255
    Else
    Me.Label12.ForeColor = 0
    End If
    'option box 2
    If Nz(Me.Frame2, 0) = 0 Then
    Me.Label23.ForeColor = 255
    Else
    Me.Label23.ForeColor = 0
    End If
    '-----------
    'code to here in a button click event for your form.
    '-----------

    Exit_btnSave_Click:
    Exit Sub

    Err_btnSave_Click:
    MsgBox Err.Description
    Resume Exit_btnSave_Click

    End Sub

    hope this helps...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Highlighting values in Table
    By lkevinc42036 in forum Access
    Replies: 2
    Last Post: 07-10-2012, 07:58 AM
  2. Highlighting current txtBox
    By SMC in forum Forms
    Replies: 1
    Last Post: 06-21-2012, 07:46 AM
  3. Highlighting Items in List Box from Table Data
    By swalsh84 in forum Programming
    Replies: 2
    Last Post: 01-25-2010, 08:55 AM
  4. Highlighting Report Data Based on a Condition
    By KramerJ in forum Reports
    Replies: 1
    Last Post: 05-29-2009, 10:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums