Use randomly selected table entry & no repeat

weevil

New member
Local time
Today, 22:38
Joined
Jun 20, 2011
Messages
7
I am trying to give the illusion of organic/natural sentences in a report i am trying to create. Basically i want it to call 1 of ~20 generic sentences and call the specifics which are entered into text boxes, example:

Hello my name is <<name>> I am <<age>> years old and live in <<country>>
Good afternoon i am called <<name>> and i am <<age>> years young, and i currently live in <<country>

That sort of thing.

What is the best way to achieve this? the sets of data will be in separate text boxes, but ideally i'd like the entire sentence in 1 field.
 
To achive this create expressions bound to the text boxes such as:
="Hello my name is "& [your table]![field containing name] & " I am" & [your table]![field containing age] & " years old and live in"& [your table]![field containing country]

Try this for all sentences.
 
many thanks for your reply.

I will implement this, that should work.

What about putting all these into an array so the report randomly picks one of the 20 or so i will create ? Or a round robin sort of setup so report 1 uses field 1, report 2 uses field 2 etc.?
 
To achive this create expressions bound to the text boxes such as:
="Hello my name is "& [your table]![field containing name] & " I am" & [your table]![field containing age] & " years old and live in"& [your table]![field containing country]

Try this for all sentences.
You can't refer to tables like that in control sources. If the form or report's record source has the field in it then you can refer to the field like that. But if the table and field are not in the record source then you can't do it like that. This is important to know. And if the field doesn't exist in more than one table in the record source you don't need the table reference. So:

="Hello my name is " & [NameFieldHere] & ". I live in " & [CountryFieldNameHere]

Just thought I should point that out.
 
Thanks for your guidance Bob/bijuvijayarajCan i create fields that contain this string, so a table is created called, for example:

TblSentances

And in TblSentances i would have a field for Introduction, Music, Hobbies for example.

And records would have things like what bob stated:

="Hello my name is " & [NameFieldHere] & ". I live in " & [CountryFieldNameHere]

Is there a way i can get the report to randomly (or not) select a record line for each field, so in the hobbies section it will select record 1, the same with music and introduction. But for the next report it would select record 2.
 

Users who are viewing this thread

Back
Top Bottom