Using a Combo Box value in Output file name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro that outputs a query to a file
I want to have the month that is chosen in a combo box to be reflected in the file name.

this is what I have but it appears to return the month_id and not the month value

="c:\" & [Forms]![frm_rebate_vendor]![vendor_name] & " " & [Forms]![frm_rebate_main]![Como5] & ".xls

the frm_rebate_main.month comes from a table with two column
Month_I
Mont

The Month_Id is an autonumber and Month is the Month Name i
1 Januar
2 Februar
3 Marc
etc

When I execute this macro it gives me a file name with Vendorname1 5.xls
What I want is Vendorname1 May.xl

Any help on fixing this

I have tried using ....[Forms]![frm_rebate_main]![combo5]![value] still get
I have tried using ....[Forms]![frm_rebate_main]![Month] Get mismatch erro

Thanks in advance
 
Assuming you have a two column Combo, use Column(1) to refer to the second
one, the text for the name.

Larry Linson
Microsoft Access MVP

Michael said:
I have a macro that outputs a query to a file.
I want to have the month that is chosen in a combo box to be reflected in the file name.

this is what I have but it appears to return the month_id and not the month value.

="c:\" & [Forms]![frm_rebate_vendor]![vendor_name] & " " &
[Forms]![frm_rebate_main]![Como5] & ".xls"
the frm_rebate_main.month comes from a table with two columns
Month_Id
Month

The Month_Id is an autonumber and Month is the Month Name ie
1 January
2 February
3 March
etc.

When I execute this macro it gives me a file name with Vendorname1 5.xls
What I want is Vendorname1 May.xls

Any help on fixing this.

I have tried using ....[Forms]![frm_rebate_main]![combo5]![value] still get 5
I have tried using ....[Forms]![frm_rebate_main]![Month] Get mismatch error

Thanks in advance
 
Michael said:
I have a macro that outputs a query to a file.
I want to have the month that is chosen in a combo box to be reflected in the file name.

this is what I have but it appears to return the month_id and not the month value.

="c:\" & [Forms]![frm_rebate_vendor]![vendor_name] & " " & [Forms]![frm_rebate_main]![Como5] & ".xls"

the frm_rebate_main.month comes from a table with two columns
Month_Id
Month

The Month_Id is an autonumber and Month is the Month Name ie
1 January
2 February
3 March
etc.

When I execute this macro it gives me a file name with Vendorname1 5.xls
What I want is Vendorname1 May.xls

Any help on fixing this.

I have tried using ....[Forms]![frm_rebate_main]![combo5]![value] still get 5
I have tried using ....[Forms]![frm_rebate_main]![Month] Get mismatch error


Try using:
Forms!frm_rebate_main!combo5.Column(1)
 
Back
Top