Results 1 to 4 of 4

Thread: Newb to access - table data

  1. #1

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Newb to access - table data

    Not sure if this is the right place for this, but ill post it anyways

    I am pretty new to using MS Access and am having quite a lot of problems with it. I seem to be trying to treat the DB as a spreadsheet.

    I find myself trying to call a certain cell of data, but I am not able to.
    Question 1: Is there a way to accomplish this?

    Also, I have all my data on a form, and I want to take that data and use it to reference a spot in a table, then I want it to look in the next column and pull the data from the appropriate row.
    Question 2: Is there an option in expression builder to do this? Will I have to use VB code? If so, can someone point me in the right direction?

    Finally, I have a spot where the user selects certain dates and then enters a numerical value beside them.
    Question 3: Is there any way I can take those values and make my table's values increase based on the number from the form?

    Any help would be greatly apreciated



    *edit*

    I am tryign to use
    VB Code:
    1. If Me![current payband] = [Academic Payband]![Payband] Then
    2. Me![Label8].Caption = [Academic Payband]![Salary] * [Standard Hours Per Week]

    but it says "Microsoft Access cannot find the field 'l' referred to in your expression"
    Last edited by kfcSmitty; May 19th, 2005 at 08:43 AM.

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Newb to access - table data

    I find myself trying to call a certain cell of data, but I am not able to.
    Question 1: Is there a way to accomplish this?
    Thats because its a database and not a (crap) spreadsheet.
    The sort of pseudo-code would be:
    - open a connection
    - open a recordset
    - retrieve field

    There are tutorials on this for Dao and Ado, depending whicch you choose.

    Also, I have all my data on a form, and I want to take that data and use it to reference a spot in a table, then I want it to look in the next column and pull the data from the appropriate row.
    Question 2: Is there an option in expression builder to do this? Will I have to use VB code? If so, can someone point me in the right direction?
    Use a combo or list box for this. As you are beginning you are probably using bound tables. When you create a combo/list box, you can have more columns, and hide those you do not the user to see.
    For example:
    First column would be hidden (width 0) and hold a primary key (autonumber/ID)
    Second column might have a text description, for the user to select.
    The control would be bound to the hidden first column and store an id in the table.

    Finally, I have a spot where the user selects certain dates and then enters a numerical value beside them.
    Question 3: Is there any way I can take those values and make my table's values increase based on the number from the form?
    yeeees... sorta, possible by using an update query pointing to the forms control. Or if it is affecting the current record, you could just have a hidden field that holds the calculation.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Newb to access - table data

    *edit*

    I am tryign to use

    Code:
    If Me![current payband] = [Academic Payband]![Payband] Then
    Me![Label8].Caption = [Academic Payband]![Salary] * [Standard Hours Per Week]
    You shouldn't have spaces in variable, controls, tables or fields names.
    Easier to program.

    You can use:
    Code:
    me.controls("current payband")
    
    'or
    
    forms(me.name)![current payband] '<< I think not sure
    Also if the code is on the form module and is referring to a form control, you do not need the ME part...
    Example:
    Code:
    Label8.Caption = cstr(50 * 10)
    If your control names have no spaces you can use them instead of Label8 (maybe lblCalced ?)
    Also read up on naming conventions for variables.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Newb to access - table data

    Quote Originally Posted by Ecniv
    You shouldn't have spaces in variable, controls, tables or fields names.
    Easier to program.

    You can use:
    Code:
    me.controls("current payband")
    
    'or
    
    forms(me.name)![current payband] '<< I think not sure
    Also if the code is on the form module and is referring to a form control, you do not need the ME part...
    Example:
    Code:
    Label8.Caption = cstr(50 * 10)
    If your control names have no spaces you can use them instead of Label8 (maybe lblCalced ?)
    Also read up on naming conventions for variables.


    I know all the rules for variables, as well as the most well known programming standards Im in a programming course. But this is more of a rough copy of my program and since it is only me who needs to understand it, i am just messing around


    Anyways I am getting the error on

    VB Code:
    1. [Academic Payband]![Payband]
    2. 'Not
    3. Me![current payband]

Posting Permissions

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



Click Here to Expand Forum to Full Width