well i have been trying to get this thing to store in a database i created in mircosoft db any help would be appreciated. Thank you in advance

Private Sub cmdadd_Click()
    optftime.Value = False
    optptime.Value = False
    optict.Value = False
    optassessmentprogramme.Value = False
    optdbt.Value = False
    opttvet.Value = False
    optcarrerdev.Value = False
    optictinstruc.Value = False
    opteventsmanagement.Value = False
    opteduandtranng.Value = False
    optcnstrudsitemanagement.Value = False
    cboparish.Text = "Select Parish"

    Adoaddlec.Recordset.AddNew
End Sub

Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdnext_Click()
Adoaddlec.Recordset.MoveNext
    If (Adoaddlec.Recordset.EOF = True) Then
        Adoaddlec.Recordset.MoveLast
        MsgBox "You are at the last record in the database", vbInformation + vbOKOnly, "Atmoic Inc"
    End If
    Call status
    Call department
    Call parish
End Sub

Private Sub cmdprevious_Click()
Adoaddlec.Recordset.MovePrevious
    If (Adoaddlec.Recordset.BOF = True) Then
        Adoaddlec.Recordset.MoveFirst
        MsgBox " You are at the first record in the database", vbInformation + vbOKOnly, "Atmoic Inc"
    End If
    Call status
    Call department
    Call parish
End Sub

Private Sub cmdsave_Click()
Dim street As String
street = txtstreet.Text

If (txtlname.Text = "") Then
        MsgBox "Last Name is compulsory", vbExclamation + vbOKOnly, "Atmoic Inc"
        txtlname.SetFocus

    ElseIf (txtfname.Text = "") Then
        MsgBox "First Name is compulsory", vbExclamation + vbOKOnly, "Atmoic Inc"
        txtfname.SetFocus
    ElseIf (optftime.Value = False) And (optptime.Value = False) Then
        MsgBox "Please select your status", vbExclamation + vbOKOnly, "Atmoic Inc"
    ElseIf (cboparish.Text = "Select Parish") Then
        MsgBox "Please select a parish", vbExclamation + vbOKOnly, "Error"
    ElseIf (street = "") Then
        MsgBox "Street should contain a street address", vbExclamation + vbOKOnly, "Atmoic Inc"
    ElseIf (txtphoneno.Text = "") And (txtcellno.Text = "") Then
        MsgBox "Work and Cell number is compulsory", vbInformation + vbOKOnly, "Atomic Inc"
    ElseIf (optict.Value = False) And (optassessmentprogramme.Value = False) And (optdbt.Value = False) And (opttvet.Value = False) And (optcarrerdev.Value = False) And (optictinstruc.Value = False) And (opteventsmanagement.Value = False) And (opteduandtranng.Value = False) And (optcnstrudsitemanagement.Value = False) Then
        MsgBox "Please select your respective department", vbQuestion + vbOKOnly, "Atomic Inc"
Else
     If (optftime.Value = True) Then
            Adoaddlec.Recordset.Fields("status") = "ft"
        ElseIf (optptime.Value = True) Then
            Adoaddlec.Recordset.Fields("status") = "pt"
        ElseIf (cboparish.Text = "Clarendon") Then
            Adoaddlec.Recordset.Fields("parish") = 1
        ElseIf (cboparish.Text = "Hanover") Then
            Adoaddlec.Recordset.Fields("parish") = 2
        ElseIf (cboparish.Text = "Manchester") Then
            Adoaddlec.Recordset.Fields("parish") = 3
        ElseIf (cboparish.Text = "Portland") Then
            Adoaddlec.Recordset.Fields("parish") = 4
        ElseIf (cboparish.Text = "St.Andrew") Then
            Adoaddlec.Recordset.Fields("parish") = 5
        ElseIf (cboparish.Text = "St.Ann") Then
            Adoaddlec.Recordset.Fields("parish") = 6
        ElseIf (cboparish.Text = "St.Catherine") Then
            Adoaddlec.Recordset.Fields("parish") = 7
        ElseIf (cboparish.Text = "St.Elizabeth") Then
            Adoaddlec.Recordset.Fields("parish") = 8
        ElseIf (cboparish.Text = "St.James") Then
            Adoaddlec.Recordset.Fields("parish") = 9
        ElseIf (cboparish.Text = "St.Mary") Then
            Adoaddlec.Recordset.Fields("parish") = 10
        ElseIf (cboparish.Text = "St.Thomas") Then
            Adoaddlec.Recordset.Fields("parish") = 11
        ElseIf (cboparish.Text = "Trelwany") Then
            Adoaddlec.Recordset.Fields("parish") = 12
        ElseIf (cboparish.Text = "Westmoreland") Then
            Adoaddlec.Recordset.Fields("parish") = 13
        ElseIf (optict.Value = True) Then
                Adoaddlec.Recordset.Fields("department") = 1
        ElseIf (optassessmentprogramme.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 2
        ElseIf (optdbt.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 3
        ElseIf (opttvet.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 4
        ElseIf (optcarrerdev.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 5
        ElseIf (optictinstruc.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 6
        ElseIf (opteventsmanagement.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 7
        ElseIf (opteduandtranng.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 8
        ElseIf (optcnstrudsitemanagement.Value = True) Then
            Adoaddlec.Recordset.Fields("department") = 9
    End If
    Adoaddlec.Recordset.Update
    MsgBox "Record Updates", , "Atomic Inc"
End If
End Sub

Private Sub Form_Load()
Call status
Call department
Call parish
End Sub
Private Sub status()
Dim stat_us As String
stat_us = Trim(Adoaddlec.Recordset.Fields("status"))
    If (stat_us = "ft") Then
        optftime.Value = True
    ElseIf (stat_us = "pt") Then
        optptime.Value = True
    End If
End Sub

Private Sub department()
Dim dep As Variant
dep = Trim(Adoaddlec.Recordset.Fields("department"))
    If (dep = 1) Then
        optict.Value = True
        ElseIf (dep = 2) Then
            optassessmentprogramme.Value = True
        ElseIf (dep = 3) Then
            optdbt.Value = True
        ElseIf (dep = 4) Then
            opttvet.Value = True
        ElseIf (dep = 5) Then
            optcarrerdev.Value = True
        ElseIf (dep = 6) Then
        optictinstruc.Value = True
        ElseIf (dep = 7) Then
            opteventsmanagement.Value = True
        ElseIf (dep = 8) Then
            opteduandtranng.Value = True
        ElseIf (dep = 9) Then
            optcnstrudsitemanagement.Value = True
    End If
End Sub


Private Sub parish()
Dim par As Variant
par = Trim(Adoaddlec.Recordset.Fields("parish"))
If (par = 1) Then
    cboparish.Text = "Clarendon"
ElseIf (par = 2) Then
    cboparish.Text = "Hanover"
ElseIf (par = 3) Then
    cboparish.Text = "Manchester"
ElseIf (par = 4) Then
    cboparish.Text = "Portland"
ElseIf (par = 5) Then
    cboparish.Text = "St.Andrew"
ElseIf (par = 6) Then
    cboparish.Text = "St.Ann"
ElseIf (par = 7) Then
    cboparish.Text = "St.Catherine"
ElseIf (par = 8) Then
    cboparish.Text = "St.Elizabeth"
ElseIf (par = 9) Then
    cboparish.Text = "St.James"
ElseIf (par = 10) Then
    cboparish.Text = "St.Mary"
ElseIf (par = 11) Then
    cboparish.Text = "St.Thomas"
ElseIf (par = 12) Then
    cboparish.Text = "Trelwany"
ElseIf (par = 13) Then
    cboparish.Text = "Westmoreland"
End If
End Sub
Private Sub cmdadd_Click()    
Adoaddlec.Recordset.AddNew
optftime.Value = False    
optptime.Value = False    
optict.Value = False    
optassessmentprogramme.Value = False    
optdbt.Value = False    
opttvet.Value = False    
optcarrerdev.Value = False    
optictinstruc.Value = False    
opteventsmanagement.Value = False    
opteduandtranng.Value = False    
optcnstrudsitemanagement.Value = False    
cboparish.Text = "Select Parish"     
Adoaddlec.Recordset.update
End Sub

this dont work as am using a different command button to save and another to add(preparing for save basically)

Also, on form select your adodc1 control, press F1, goto properties on the help file>select Recordset Property Ado Data Control>and read what you may have to do to get the above to work.

Good Luck

when i press f1 it says msdn missing i need to reinstall i installed msdn though, and i did a form just the said way using the same conventions and it worked i don't know... the ado controller is correctly connected the connectionstring is set, the recordsource is set and table selected. and everything else except the parish and deparment sends to the database so what else could be the problem.


Thanksfor your help so vb5prgrmr

ok nother thing i had to change the data type a dip to variant and parish to so too or i was getting an error when i clicked my save button on the form, i assumed its because the fields are empty... the same code i have for dep is the same for status, and it works u know so idk

so then you have it working?

irght it works meaning it runs without giving errors and all but in terms a saving those specified fields in the database no it doesnt and thats the aim a the poject really. ahhh idk i sat up all night re code it and stilll the same issue a thinking its just a small problem too just can't see it

okay, from the help files

Recordset Property (ADO Data Control)
      

Returns or sets a reference to the underlying ADO Recordset object.

Syntax

object.Recordset [= recordset]

The Recordset property syntax has these parts:

Part Description 
object Anobject expression that evaluates to an object in the Applies To list. 
recordset A recordset object. 


Remarks

Using the Recordset property, you can use the methods, properties, and events of the ADOADODB.Recordset Object.

You must use the Set statement with the Recordset property, as shown below:

Dim rsNwind As New ADODB.Recordset
' Code to open the ADO Recordset object not shown here.
Set ADODC1.Recordset = rsNwind

If you intend to program the events of the Recordset object, declare an object variable using the WithEvents keyword, as shown below.

Option Explicit
Dim WithEvents rsNames As ADODB.Recordset

Private Sub Form_Load()
   Set rsNames = New ADODB.Recordset
   ' Code to create recordset not shown.
   rsNames.MoveFirst ' Move to the beginning of the recordset.

   Set ADODC1.Recordset = rsNames

   With Text1
      Set .DataSource = ADODC1
      .DataField = "Name"
   End With
End Sub

Private Sub rsNames_FieldChangeComplete(ByVal cFields As Long, _
ByVal Fields As Variant, ByVal pError As ADODB.Error, adStatus As _
ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
   Debug.Print "New Name", pRecordset!Name
End Sub

and

Recordset Object (ADO)
               

A Recordset object represents the entire set of records from a base table or the results of an executed command. At any time, the Recordset object refers to only a single record within the set as the current record.





Remarks

You use Recordset objects to manipulate data from a provider. When you use ADO, you manipulate data almost entirely using Recordset objects. All Recordset objects are constructed using records (rows) and fields (columns). Depending on the functionality supported by the provider, some Recordset methods or properties may not be available.

ADOR.Recordset and ADODB.Recordset are ProgIDs that you can use to create a Recordset object. The Recordset objects that result behave identically, regardless of the ProgID. The ADOR.Recordset is installed with Microsoft® Internet Explorer; the ADODB.Recordset is installed with ADO. The behavior of a Recordset object is affected by its environment (that is, client, server, Internet Explorer, and so on). Differences are noted in the Help topics for properties, methods, and events.

There are four different cursor types defined in ADO: 

Dynamic cursor—allows you to view additions, changes, and deletions by other users, and allows all types of movement through the Recordset that don't rely on bookmarks; allows bookmarks if the provider supports them.


Keyset cursor—behaves like a dynamic cursor, except that it prevents you from seeing records that other users add, and prevents access to records that other users delete. Data changes by other users will still be visible. It always supports bookmarks and therefore allows all types of movement through the Recordset. 


Static cursor—provides a static copy of a set of records for you to use to find data or generate reports; always allows bookmarks and therefore allows all types of movement through the Recordset. Additions, changes, or deletions by other users will not be visible. This is the only type of cursor allowed when you open a client-side (ADOR) Recordset object.


Forward-only cursor—behaves identically to a dynamic cursor except that it allows you to scroll only forward through records. This improves performance in situations where you need to make only a single pass through a Recordset. 
Set the CursorType property prior to opening the Recordset to choose the cursor type, or pass a CursorType argument with the Open method. Some providers don’t support all cursor types. Check the documentation for the provider. If you don't specify a cursor type, ADO opens a forward-only cursor by default.

When used with some providers (such as the Microsoft ODBC Provider for OLE DB in conjunction with Microsoft SQL Server), you can create Recordset objects independently of a previously defined Connection object by passing a connection string with the Open method. ADO still creates a Connection object, but it doesn't assign that object to an object variable. However, if you are opening multiple Recordset objects over the same connection, you should explicitly create and open a Connection object; this assigns the Connection object to an object variable. If you do not use this object variable when opening your Recordset objects, ADO creates a new Connection object for each new Recordset, even if you pass the same connection string.

You can create as many Recordset objects as needed.

When you open a Recordset, the current record is positioned to the first record (if any) and the BOF and EOF properties are set to False. If there are no records, the BOF and EOF property settings are True.

You can use the MoveFirst, MoveLast, MoveNext, and MovePrevious methods, as well as the Move method, and the AbsolutePosition, AbsolutePage, and Filter properties to reposition the current record, assuming the provider supports the relevant functionality. Forward-only Recordset objects support only the MoveNext method. When you use the Move methods to visit each record (or enumerate the Recordset), you can use the BOF and EOF properties to see if you've moved beyond the beginning or end of the Recordset.

Recordset objects can support two types of updating: immediate and batched. In immediate updating, all changes to data are written immediately to the underlying data source once you call the Update method. You can also pass arrays of values as parameters with the AddNew and Update methods and simultaneously update several fields in a record.

If a provider supports batch updating, you can have the provider cache changes to more than one record and then transmit them in a single call to the database with the UpdateBatch method. This applies to changes made with the AddNew, Update, and Delete methods. After you call the UpdateBatch method, you can use the Status property to check for any data conflicts in order to resolve them.

Note   To execute a query without using a Command object, pass a query string to the Open method of a Recordset object. However, a Command object is required when you want to persist the command text and re-execute it, or use query parameters.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.