Results 1 to 3 of 3

Thread: help

  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Unanswered: help

    Hello everyone,

    I am new to this forum and not a pro in access. Right now I am working on a database and came across a problem.

    The thing i am trying to get working is:
    I want to be able to look for values in "manager_funds" table based on criteria I choose in "Forms![1/4_manager_analysis]!first_criteria_combo" and output it in the report. I know that I can create a query to do that, but I have mutiple tables (one for each quarter) and I will be using the code above to achieve that.

    Here is the vba code:
    Dim table_name As String
    Dim rst As DAO.Recordset
    Dim DB As DAO.Database
    Set DB = CurrentDb()
    Dim sql As String


    ' Completing first critera
    sql = "Select * from manager_funds where fund_num=" & Forms![1/4_manager_analysis]!Fund_Name_analysis
    Set rst = DB.OpenRecordset(sql)

    If (rst.RecordCount > 0) Then
    rst.Edit
    If IsNull(rst![current p/e].Value) Then
    'Forms![1/4_manager_analysis]!first_criteria_combo
    first_0.Value = "No fund info is available"
    Else
    first_0.Value = rst![current p/e]
    End If

    rst.Update
    rst.close
    Else
    first_0.Value = "No fund info is available"

    End If

    So what I want this to do is
    currently there is a "if isnull(rst![current P/E].value) then"
    i want this "Current P/E" to be changing with whatever i choose in "Forms![1/4_manager_analysis]!first_criteria_combo", but whenever i change [current p/e] to "Forms![1/4_manager_analysis]!first_criteria_combo" it says that "Run-time error '3265': item not found in this collection.

    [Current P/E] is a column in "manager_funds" table.

    If anyone has any suggestion how to do it differently please feel free.

    thanks guys

  2. #2
    Join Date
    Jan 2013
    Posts
    2
    bump. Anybody have thoughts?

    Thanks

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    sorry my eyes glazed over with your application's jargon.

    what is first_0. ?
    your code will alwasy report No fund info is available as its the last line in the funcion/sub routine.

    if you are struggling then I'd stronlgy recommend that you you understand debugging in Access.

    create a watch/breakpoint then step through the code
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

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