I need help with code for a button on a Form in my VBA application.
I would like to copy and save all currently selected text from a word document to a table in an SQL Server Database in response to the Click event of this Button on a VBA Form.
The name of the database is WriterDemo
The location of the database is as follows:
conn = New SqlConnection("Data Source=GulgeePC\sqlexpress;Initial Catalog=WriterDemo;Persist Security Info=True;User ID=sa;Password=momin;Connect Timeout=30")
The Name of the table in the WriterDemo Database into which I wish to save text is dbo.t_notes (I would like to save the text from word into note column of this table. Client ID will be 222 and all the notes will be for the Client with this ID. Note ID and t_date will be generated automatically as the note is save in the note column by the click event of the Button on my Form.
The columns in this table are as folow:
Notes_id (primary key, numeric (18,0) not null)
Client_id (numeric((18,0) not null)
t_date (datetime, not null)
note (nvarchar (4000), null)
Many thanks for your help.