How do you execute a Insert statement?
I have two forms, one for adding a new client, and for for calculating payments. These forms are linked via a drop down menu.
On the reservations form, I have labels: Surname, Firstname, Street, Town, Postcode, Phone, Email, and Date of Arrival. Opposite these labels I have text boxes. At the bottom of this page is a cmd botton, 'Add New Client.' The new person's details are then stored in a Clients table in Access.
I have been told that to execute this task, I need to use a Insert statement. But I don't know how to, or how to write one, or what it would look like. I'm not really sure what variables I need to declare, but I have been given a list of coding that I will list below. I'm not sure whether this piece of coding goes in this form or in the payments form, to calculate the person's bill after a period of stay. The coding is:
Private rsclients As ADODB.Recordset
Const connstr = "Provider=Microsoft.Jet.OLEDB.4.0:data source = f:(and then the location of the file)"
Private conn As ADODB.Connection
Private cmdaddnewclient As ADODB.Command
Private required As long
Private sql As string
Are these the variables that I need to declare? How do I write a Insert statement? What does it look like? Does the Insert statement go behind the cmd button? I'm grateful for all help, suggestions and examples. Thanks for reading and replying. Brendan
|