Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Jacksonville,NC, USA
    Thanked 0 Times in 0 Posts

    Write VB field to Access table field (VB6 and Access 2000)

    Having a small problem here as always: Am trying to send the input of lstQuotedQty in a VB form field into an Access Table named Stock and a field called fldSold...

    Keeps stopping on the words: ListItem in the following line:
    strSQL = "Insert Into tblStock (fldSold) VALUES(" & CDbl(lstQuotedQty.ListItem(i)) & ")"

    Private Sub Add_Item2_Click()

    Dim adoDSN As ADODB.Connection
    Dim strSQL As String
    Dim strConString As String
    Dim i%

    strConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
    & App.Path & "Inventory.mdb" & ";Persist Security Info=False"
    Set adoDSN = New ADODB.Connection
    adoDSN.Open strConString
    For i = 0 To lstQuotedQty.ListCount
    strSQL = "Insert Into tblStock (fldSold) VALUES(" & CDbl(lstQuotedQty.ListItem(i)) & ")"
    adoDSN.Execute strSQL
    Next i
    Set adoDSN = Nothing

    End Sub

    saying method or data member not found...what might i be missing here?
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: Write VB field to Access table field (VB6 and Access 2000)

    I don't think it can be a database (ADO) problem, because all you are doing is constructing a string.

    If you MsgBox "i=" & i & vbCrLf & "value=" & lstQuotedQty.ListItem(i) immediately prior, what, if anything, do you get? If the problem is on the last item, try making the end of the loop [b]lstQuotedQty.ListCount

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts