Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006

    Question Unanswered: Openrecord Set value error! Guys Help Here

    Hello fellows,

    I,m stuck on this form and button for a while and have tried varies methods but was unable to resolve the issue with my knowledge of vb in access.

    I have a form with a unbound text field (txtsearch) where staff enters CustId (dmbarcode) and then click on a cmdbutton(check) which should populate another form with the customer details which works fine if I have a docmd.openform function but when I try to add some exception handling into it, the error displays with "match not found for: txtsearch" which I added in the code at the end against ELSE.
    Just to figure out what the dbopenrecordset is picking up from the field dmbarcode in tbl_SO Cust Master, I changed the code in the ELSE error from ScanBarcodeSearch to Dmbarcodecheck and turns out that it picks out the first record only of the field in the table.

    But I need to check the whole field to find a match and display the details in the next form or display error with no match found.

    Private Sub Check_Click()
    Dim db As DAO.Database
    Dim snp As DAO.Recordset
    Dim Dmbarcodecheck As String
    Dim ScanBarcodeSearch As String

    ScanBarcodeSearch = Me.TXTSearch
    Set db = CurrentDb
    Set snp = db.OpenRecordset("SO Cust Master", dbOpenSnapshot)
    Dmbarcodecheck = snp!DMBarcode

    ScanBarcodeSearch = Me.TXTSearch

    If ScanBarcodeSearch = Dmbarcodecheck Then
    MsgBox "Match Found For: " & ScanBarcodeSearch, , "Customer Found!"
    DoCmd.OpenForm "search", acNormal, "", "[SO Cust Master].DMBarcode=" & "'" & Me.TXTSearch & "'", acEdit, acNormal
    DoCmd.Close acForm, "paratest"
    'If value not found sets focus back to txtSearch and shows msgbox
    MsgBox "Match Not Found For: " & ScanBarcodeSearch & " - Please Try Again.", _
    , "Invalid Search Criterion!"
    End If
    End Sub

    Thanks in Advance,
    Please help me out here as I need to finish the apps by Friday.
    Last edited by riqband; 02-28-06 at 04:56.

  2. #2
    Join Date
    Feb 2006
    Added to get it up again. can anybody provide some assistance!

Posting Permissions

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