Form (Converting month to a value)

Okay do this, create a hidden text box(unbound) name it hidTxtControl on the Form and set its control source as..
Code:
= Me.ComboBoxName.Column(2)
Then in the Append Query change it as...
Code:
INSERT INTO tblFitnessTest (TestID, TestMonth, TestComments)
SELECT [Forms]![frmNewTest]![myFitnessTestID] AS Expr1,  [Forms]![frmNewTest]![[B]hidTxtControl[/B]] AS Expr2,  [Forms]![frmNewTest]![txtComments] AS Expr3;
 
Bizarre, it now leaves the month and testcomments field blank in the tblFitness test after executing the append query.

hidTxtControl control source:
=[me].[cboMonth].[column](2)

Ammended query:
INSERT INTO tblFitnessTest ( TestID, TestMonth, TestComments )
SELECT [Forms]![frmNewTest]![myFitnessTestID] AS Expr1, [Forms]![frmNewTest]![hidTxtControl] AS Expr2, [Forms]![frmNewTest]![txtComments] AS Expr3;
 
On the form it diplays #name error for the hidTxtControl
 
That would be my bad.. remove the Me. just use
Code:
= ComboBoxName.Column(2)
 
Thank you, phew what a struggle! the(2) needed changing to (1) as well. Cheers you have been a great help.

Until next time!

Darth
 
When you say that you need to store it as a Month does that mean that May last year is exactly the say as May this year. Or do you want May 2012 stored with 2012 hidden from view.

EDIT

I didn't see page two and therefore did not realise the show was over.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom