Dick7Access
Dick S
- Local time
- Today, 17:13
- Joined
- Jun 9, 2009
- Messages
- 4,325
These two set of code are link fields in a datasheet view. They populate the corresponding text boxes on the form view that matches the color generated by the numbers picked by the user for the RGB colors.
It works fine the first time around, but if both text boxes have colors in them and I try and change one of them it gives me run time error 2110, Access can’t move focus to the control txtName1
I have been over the code lots of time and I don’t know what to try.
It works fine the first time around, but if both text boxes have colors in them and I try and change one of them it gives me run time error 2110, Access can’t move focus to the control txtName1
I have been over the code lots of time and I don’t know what to try.
Code:
Private Sub txtOpen1_Click()
DoCmd.GoToControl "txtcolor1red" 'converts red number to variabole
StrRed = Me.txtcolor1Red.Text
DoCmd.GoToControl "txtcolor2green" ' converts green number to variable
StrGreen = Me.txtcolor2Green.Text
DoCmd.GoToControl "txtcolor3blue" 'converst blue number to veriable
StrBlue = Me.txtcolor3Blue
txtColor1.BackColor = RGB(StrRed, StrGreen, StrBlue) 'applies selectered color to color_text box
DoCmd.OpenForm "frmMain"
DoCmd.GoToControl "txtname1"
Str1stName = Me.txtName1.Text
DoCmd.GoToControl "text15"
Me.Text15 = Str1stName
End Sub
Code:
Private Sub txtOpen2_Click()
DoCmd.GoToControl "txtcolor1red" 'converts red number to variable
StrRed = Me.txtcolor1Red.Text
DoCmd.GoToControl "txtcolor2green" ' converts green number to variable
StrGreen = Me.txtcolor2Green.Text
DoCmd.GoToControl "txtcolor3blue" 'converst blue number to veriable
StrBlue = Me.txtcolor3Blue
txtColor2.BackColor = RGB(StrRed, StrGreen, StrBlue) 'applies selectered color to color_text box
DoCmd.OpenForm "frmMain"
DoCmd.GoToControl "txtname1"
strname2 = txtName1.Text
DoCmd.GoToControl "txtname2"
Me.txtName2.Text = strname2
Me.txtName1.Visible = False
End Sub