Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Angry Unanswered: Method or data member not found

    Can someone look at this code and tell me what's wrong??

    Private Sub Form_Current()

    Dim count As Integer
    Dim var1 As Integer
    Dim updateStatement As String, rs As Recordset


    updateStatement = "Select top1 partinstinceid from Tblpartinstance where ordered = this.orderid and partid = this.partid and partlocation = 1"
    val1 = rs.getVal1
    Update Tblpartinstance
    Set datereceived = txtDatReceived And PartLocation = cboPartLocation
    where partinstnceid = var1
    End

  2. #2
    Join Date
    Nov 2002
    Location
    Hamilton,Ontario
    Posts
    132

    Hope this helps.

    Private Sub Form_Current()
    'Declaratin of variables
    Dim count As Integer
    Dim var1 As Integer
    Dim SQLStmt As String
    Dim rs As Recordset
    Dim curdb as database
    'Error Trapping
    On Error GoTo Err_Handler
    Dim formname as FOrm
    'setting the database to current database
    set curdb=Currentdb()
    'setting fornmae to current form
    set formname=Forms![put ur fornname here].Form
    'Open Table
    SQLSTmt = "Select * from [Tblpartinstance] where [ordered] = " & formname@[orderid] & "" AND [partid] ="" & formname![partid] & """ and [partlocation] = '" & formname![partlocation]="'""
    'Open recordset
    set rs=curdb.openrecordset(SQLSTmt,dbopendynaset)
    if rs.eof=true then
    msgbox "Can not access table",vbcritical,"Error in accessing table"
    'close recordset and eliminate meemory leaks and exit sub
    rs.close
    set rs=Nothing
    curdb.close
    set curdb=nothing
    Exit sub
    else
    do until rs.eof
    rs.edit
    val1 = rs![getVal1]'I assuem this is the field in table
    rs![datereceived] = txtDatReceived
    rs![ PartLocation] = cboPartLocation
    rs.update
    rs.movenext
    Loop
    rs.close
    set rs=Nothing
    curdb.close
    set curdb=Nothing
    exit sub
    End
    'ErrorHandler
    Err_Handler:
    msgbox Err.number & Err.description
    err.clear
    Exit sub
    End Sub

Posting Permissions

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