Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a combobox in a form

Status
Not open for further replies.

ronwmon

Programmer
Jul 13, 2007
97
US
I need to update a field named BillMonth in a table named TW_Data with the contents of two comboboxes, combo4 and combo6.

Combo4 contains two fields, the month name, ie January February... The second field contains the month number ie 01,02...

Combo6 contains the 4 digit year.

I need to update the field BillMonth in table TW_Data to the month number, "-" and year. Like 01-2014.

My code:

UPDATE TW_Data SET TW_Data.BillMonth = [Forms]![A-Prep]!combo4.column(1) & "-" & combo6
WHERE (((TW_Data.BillMonth) Is Null));

The error I get is "Undefined function '[Forms]![A-Prep]!combo4.column' in expression."

Any help is appreciated.

Ron--
 
First, rename your combo4 and combo6 to something meaningful like cboMonths and cboYear

"Combo4 contains two fields" - do you mean 2 fields concantinated to display:[pre]
January 01
February 02[/pre]

or 2 fields in 2 columns:[pre]
col 1 | col 2
January | 01
February | 02[/pre]

>My code:
>
>UPDATE TW_Data SET TW_Data.BillMonth = [Forms]![A-Prep]!combo4.column(1) & "-" & combo6
>WHERE (((TW_Data.BillMonth) Is Null));

That's not your code.
You code would look something like:

strSQL = " UPDATE TW_Data SET TW_Data.BillMonth = '" & [Forms]![A-Prep]!combo4.column(1) & "-" & combo6 & "' WHERE TW_Data.BillMonth Is Null"



Have fun.

---- Andy
 

I agree with Andy - rename you combo boxes.

Combo4 contains two fields, the month name, ie January February... The second field contains the month number ie 01,02...

The first column is column(0), the second is column(1).




Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top