?
Solved

Spin Box Control used on Continuous Form

Posted on 2005-02-26
5
Medium Priority
?
410 Views
Last Modified: 2006-11-17
I originally used an Access Form with a Default View of Continuous Forms. Within the design of the form, in
the Detail Section I placed a Combo Box. For the Combo Box I used a Row Source Type of a Value List and placed the accompanying values in the Row Source as 0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15

The form has a Record Source of a States table. Thus, when I run the Form, it displays 50 rows forthe 50 states. For each row, the user can use the Combo Box to select values in the range of 1 to 15. This form works fine. However, I thought it could be improved upon. Instead of a Combo Box, I planned on switching to a Spin Box Control which I read about in a VBA For Dummies Programming Book.

I copied the Spin Box Control picture images off the web. Then I inserted these picture images of the Spin Box Controls onto the Detail Section of my Continuous Form as a substitute for the Combo Box. I placed a text box which would receive the values 0 to 15 (to the side of these spin box controls) and assigned the text box a default value of 0.  Now when I run the continous form, I once again have 50 rows for the 50 states. However, when I click on the Spin Box Control Up or Down arrows, the values ONLY change on the 1st row. In other words, no matter which row I used to click on a Spin Box Control, the ONLY accompanying text box that changes values is the top row. Do you know how I can fix this problem ?

I proceeded to add the following lines of code into the
On Click Events for the Spin Box Controls Down and Up buttons.

Private Sub SpinDownBttnI_Click()
   'Decrease Skip By 1 to a minimum of 0
   If Me.IRAFS.Value > 0 Then
      Me!IRAFS.Value = Me!IRAFS.Value - 1
   End If
End Sub

Private Sub SpinUpBttnI_Click()
   'Increase Skip By 1 to a maximum of 15
   If Me.IRAFS.Value < 15 Then
      Me!IRAFS.Value = Me!IRAFS.Value + 1
   End If
End Sub
 
0
Comment
Question by:zimmer9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 85
ID: 13413674
One of two things:

1. Is the textbox Unbound? If so, you'll get this type of behaviour. Bind the textbox to a field (can be a dummy field in your table, if needed) and try it.

2. Are you setting focus to the record when you click the images? I don't use images like this, so I can't be sure, but make sure this isn't a focus issue by typing something into the record you're testing ... IOW, make SURE the record you're editing has the focus
0
 

Author Comment

by:zimmer9
ID: 13414615
I added a SetFocus statement to my code which I show below. It doesn't seem to make a difference in terms of the fact that the focus doesn't shift from one text box to another.

Obviously if I click inside the text box that I am trying to update and then click on the Spin Box Control next to the text box, then the correct text box is updated. However, when I simply click on 1 Spin Box Control and then switch to another Spin Box Control without entering the corresponding text box, only the last text box that was entered will be updated. Is there a way to get around this problem ?

Private Sub SpinDownBttnI_Click()
   'Decrease Skip By 1 to a minimum of 0
   Me.IRAFS.SetFocus
   If Me!IRAFS.Value > 0 Then
      Me!IRAFS.Value = Me!IRAFS.Value - 1
   End If
End Sub

Private Sub SpinUpBttnI_Click()
   'Increase Skip By 1 to a maximum of 15
   Me.IRAFS.SetFocus
   If Me!IRAFS.Value < 15 Then
      Me!IRAFS.Value = Me!IRAFS.Value + 1
   End If
   
End Sub
0
 
LVL 85
ID: 13414736
1. Is the textbox Unbound? If so, you'll get this type of behaviour. Bind the textbox to a field (can be a dummy field in your table, if needed) and try it.
0
 

Author Comment

by:zimmer9
ID: 13415127
For the text box, if I click on the DATA tab, next to the Control Source, I selected a field from a table.
In the form, if I click on the DATA tab, next to the Record Source is the name of this same table. Thus, I would say that the text box field is bound.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 13415194
Yes, it's bound ... your image control, of course, isn't and merely clicking on this may not set the focuse to your current record. Try placing a label or other control (perhaps a Frame) on top of your image control and set the properties so that you can't see it (the lable, not your spinbuttons). See if this forces your continuous form to properly set the focus ... if not, you can always rework your interface to use buttons instead of an image control ...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

800 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