Make a unbound field = 1

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
Code:
Private Sub Command11_Click()
On Error GoTo Command11_Click_Err

     updateQuery1
    DoCmd.OpenForm "frm_NIS_TSL", acNormal, "", "", , acNormal
        [TextSql].Value = 1

Command11_Click_Exit:
    Exit Sub

Command11_Click_Err:
    MsgBox Error$
    Resume Command11_Click_Exit

End Sub

How do I get TextSql to equal 1 in this event? Its an unbound text field
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Forms!frm_NIS_TSL.TextSql = 1?
or
Forms!frm_NIS_TSL.TextSq= "1" ?
 
Upvote 0
I get a message "Application-defined or Object-defined error

Code:
Private Sub Command11_Click()
'Go to TSL Button
On Error GoTo Command11_Click_Err

     updateQuery1
    DoCmd.OpenForm "frm_NIS_TSL", acNormal, "", "", , acNormal
    Forms!frm_NIS_TSL.TextSq = 1


Command11_Click_Exit:
    Exit Sub

Command11_Click_Err:
    MsgBox Error$
    Resume Command11_Click_Exit

End Sub
 
Upvote 0
Got it!

It was missing an "l"

Forms!frm_NIS_TSL.TextSq = 1

Forms!frm_NIS_TSL.TextSql = 1

Thank You!
 
Upvote 0
Yup, I made boo boo in 2nd example, which was intended for where value would be text.
You're welcome.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top