?
Solved

Change value in label when textbox value changes

Posted on 2012-09-11
1
Medium Priority
?
436 Views
Last Modified: 2012-11-16
I have an Access table with 5 records and 2 fields.  Currently, Field1 is populated with the record number and Field2 is blank. It looks like this:

Field1     Field2
1
2
3
4
5

I have an Access form that has a textbox on it for the user to type in an answer to each of 5 questions.  I have Next Record and Previous Record command buttons on the form. I want each question displayed in a label (unless there is a better way of doing this) depending on what record number the user is on.  So, if a user is on record #1, I want question #1 displayed in the label. If the user clicks the Next Record button, I want question #2 displayed in the label, etc.  I thought of saving the questions in a table but because I need to format them (some words in a question need to be italic, etc), I figured I'd just hard code the questions in the code window and display them in the label depending on what record the user is on. On my form (which has MyTable as its record source), I have a textbox whose control source is Field1 of the table, so that control can be referenced to know which record the user is currently on.  How do I get the correct question to display in the label based on what record number the user is on? Thank you.
0
Comment
Question by:dbfromnewjersey
1 Comment
 
LVL 61

Accepted Solution

by:
mbizup earned 1400 total points
ID: 38387621
Assuming that your form is in Single Form view, you can do this in the Current Event of your form:

Select Case Me.Field1
        Case 1:
                 Me.lblQuestion.Caption  = "question 1"
        Case 2:
                 Me.lblQuestion.Caption  = "question 2"
        Case 3:
                 Me.lblQuestion.Caption  = "question 3"
' etc
End Select

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question