Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have some code that works first time but after putting the record in a table reports a data type mismatch when run again?? Thanks

    MySql = "SELECT RelatedTapes.ID3, RelatedTapes.ID1, RelatedTapes.Barcode FROM RelatedTapes"

    Set rs = db.OpenRecordset(MySql, dbOpenDynaset)

    strSearch = "[Barcode] = " & Me.List89.Column(0) & " AND " & _
    "ID3 = " & Me.ID3.Caption

    rs.FindFirst strSearch

    If rs.NoMatch Then

    ' Not found, so put in
    rs.AddNew
    rs.Fields("ID3") = Forms!Descriptions4.Form.ID1.Caption
    rs.Fields("ID1") = Forms!Descriptions4.Form.ID3.Caption
    rs.Fields("Barcode") = Me.List89.Column(0)
    rs.Update

    Else

    MsgBox "FOUND"


    End If

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='ZOR' post='770180' date='12-Apr-2009 16:51']I have some code that works first time but after putting the record in a table reports a data type mismatch when run again??[/quote]
    What is the line where the error occurred ?
    What is the type of Me.List89.Column(0) and Me.ID3.Caption ? String or Number ?
    Francois

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Many thanks. I nearly tore what bit of hair I had left this afternoon trying variuos alternatives until I got it working. In the end I used the line

    strSearch = "[Barcode] = '" & Me.List89.Column(0) & "'" & " AND " & "ID3 = " & Me.ID3.Caption & ""

    The forum seems very quiet, probably people enjoying the weekend, but thanks for coming in. Have a good one.

Posting Permissions

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