Original Post
Hi I have to create the code for an add click event that is very similar to the following code... This Add function requires only a single SQL action query. I know I'm missing some lines of code because a new record isn't actually being added to the database that the sql query is trying to reach... Thanks for any help on this! Private Sub addButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click editForm.Text = "Add Record" If editForm.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim dev As String = editForm.developmentComboBox. _ SelectedValue.ToString() Dim bedrooms As String = editForm.bedroomsTextBox.Text Dim price As String = editForm.priceTextBox.Text. _ Replace("$", "").Replace(",", "") Dim mls As String = editForm.mlsNumberTextBox.Text Dim strSql As String If dev <> "" And bedrooms <> "" And price <> "" And _ mls <> "" Then strSql = _ ("INSERT INTO Houses (Development, Bedrooms , Price, [MLS Number]) " _ & "VALUES (" & dev & ", " & bedrooms & ", " & price _ & ", '" & mls & "');") Else Dim msg As String = "Required data is missing. No action taken." MessageBox.Show(msg, "Error", MessageBoxButtons.OK) End If End If End Sub