Hi all vba'ers.
Excuse my ignorance, i am new to VBA (2 days) from a java background, quite a difference!!
Here's my query: I made a form with the wizard which has a series of text areas on it, displaying all the information in table 'ContractorSpend':
ContractorId(primary key), Cost00, Cost01, Cost02
I didn't have to code anything the wizard set it up. On the same form i have a Label. I basically want to take the 'ContractorId' value, and using Table 'Contractors':
ContractorId(primary key), FirstName, LastName
obtain the name values and load them into the label.
Now i coded a nice SQL statement with some ADO objects to do this, and put it in the FormCurrent() event and it works fine.
I wondered if there is an easier way to do it??? Is it possible to just open my form in 'design mode', right click on the label, and build an expression to do this, which would save me writing vb code?
Now i face my problems:
1) i don't know if this is possible
2) I cannot find ANY help on how to write expressions other than the crummy one in the Access help
3) Every time i try one there is a 'syntax error', but instead of giving me any info, the expression builder just automatically closes and i have to start again from scratch.
Here is my sql statement:
stSql = "SELECT Contractors.FirstName, Contractors.LastName FROM Contractors WHERE (((Contractors.ContractorId)=" & idval & ");"
'idval' is the value of the ContractorId I am searching for. It is lifted out of one of the controls.
Can anyone tell me what this statement should be in the expresssion builder?? Let's say the name of my label is 'NameLabel'.
Also , could anyone give me any URL's for some help on the expression builder?
it would be most appreciated
thanks
john
Excuse my ignorance, i am new to VBA (2 days) from a java background, quite a difference!!
Here's my query: I made a form with the wizard which has a series of text areas on it, displaying all the information in table 'ContractorSpend':
ContractorId(primary key), Cost00, Cost01, Cost02
I didn't have to code anything the wizard set it up. On the same form i have a Label. I basically want to take the 'ContractorId' value, and using Table 'Contractors':
ContractorId(primary key), FirstName, LastName
obtain the name values and load them into the label.
Now i coded a nice SQL statement with some ADO objects to do this, and put it in the FormCurrent() event and it works fine.
I wondered if there is an easier way to do it??? Is it possible to just open my form in 'design mode', right click on the label, and build an expression to do this, which would save me writing vb code?
Now i face my problems:
1) i don't know if this is possible
2) I cannot find ANY help on how to write expressions other than the crummy one in the Access help
3) Every time i try one there is a 'syntax error', but instead of giving me any info, the expression builder just automatically closes and i have to start again from scratch.
Here is my sql statement:
stSql = "SELECT Contractors.FirstName, Contractors.LastName FROM Contractors WHERE (((Contractors.ContractorId)=" & idval & ");"
'idval' is the value of the ContractorId I am searching for. It is lifted out of one of the controls.
Can anyone tell me what this statement should be in the expresssion builder?? Let's say the name of my label is 'NameLabel'.
Also , could anyone give me any URL's for some help on the expression builder?
it would be most appreciated
thanks
john