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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes and mailmerge

Status
Not open for further replies.

Fibee

Programmer
Jul 26, 2002
39
GB
Hi

I have a table with a number of dates that are checkboxes. I need to mailmerge this table into a letter and display the label of the checkbox rather than the True/False value of the check box. I have tried an IIF statement so if the value is true to display the date (eg. IIf([Main]![23/07]=True,"23 July") but I keep getting 'datatype mismatch in criteria expression'. Can anyone help?

Many Thanks

Fi
 
Have you considered normalizing your table structure?

IIf() should contain three arguments, not two.

Is [23/07] an actual field name?

How/where are you attempting to use this expression? If in a query, please provide the complete SQL view.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Hi

The sql is:

SELECT Main.Name, Main.Address, Main.Town, Main.Postcode, Venues.[venue name], Main.Date_of_Booking, Venues.Time, Main.[23/07]
FROM Venues INNER JOIN Main ON Venues.[venue name] = Main.venue
WHERE (((Main.[23/07])=IIf([Main]![23/07]=True,"23rd July")));

[23/07] is a boolean field name in the main table. I have tried the IIF with 3 arguments but it didn't make any difference.

Thanks

Fi
 
how about:
Code:
SELECT Main.Name, Main.Address, Main.Town, Main.Postcode, Venues.[venue name], Main.Date_of_Booking, Venues.Time, "23rd July"
FROM Venues INNER JOIN Main ON Venues.[venue name] = Main.venue
WHERE Main.[23/07];

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
That appears to put 23rd July in all fields I only want the 23rd July to appear where the check box is true?
 
It should only be selecting records where the checkbox is true:

Code:
WHERE Main.[23/07]

So then it should be in every record.

For what you want, I'm now guessing:
Code:
SELECT Main.Name, Main.Address, Main.Town, Main.Postcode, Venues.[venue name], Main.Date_of_Booking, Venues.Time, IIf(Main.[23/07], "23rd July", "Not 23rd July") As DateOfVenue
FROM Venues INNER JOIN Main ON Venues.[venue name] = Main.venue;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top