• September 24, 2021


Bring Technology Ideas with you

 Using Textbox in MS Access to run SQL Command

Have you ever try to run SQL Statement in Microsoft Access Form? It is a very powerful tool for beginner to start learning SQL programming language. By opening Microsoft Access then go to Create, by creating a new form—> I prefer choosing Modal dialogue form

    Then go to Design Tab and choose Textbox, Command Button, Label to design the form

    Image may contain: text

      After please name those tools as you wish but make sure that you have correct from our code to yours. You can copy as below:

      Private Sub bntRun_Click()
      If Me.txtstring.Text = “” Then
      MsgBox “Please enter sql command”
      Exit Sub
      Dim query As String

      query = Me.txtstring.Text
      DoCmd.RunSQL (query)
      End If

      Related post