|
-
May 19th, 2005, 08:30 AM
#1
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:
If Me![current payband] = [Academic Payband]![Payband] Then
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.
-
May 19th, 2005, 08:47 AM
#2
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.
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...
-
May 19th, 2005, 08:54 AM
#3
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.
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...
-
May 19th, 2005, 08:58 AM
#4
Re: Newb to access - table data
 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:
[Academic Payband]![Payband]
'Not
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|