C
CHAVOUSA
I am using MS Access VBA.
I have a database with two tables..Products and Keywords. In the Products
table I have a field named suggested_keywords which is a memo type field and
is currently empty. In the Keywords table, I have about 1000 records. Each
records has an unique keyword value.
What I am trying to accomplish is to update the suggested_keywords field in
all existing Products records with 10 random keyword values each, from the
Keywords table. They would be separated by a comma within that field.
Obviously, each suggested_keywords field in every product record would have a
different combined value because it would update with random values.
I have tried several queries and VBA code samples found on DBforums and other
sites without any success.
Can anyone assist with this or provide some advise? Thanks.
The code below is from two queries I tried using. However, the queries update
all records with only one keyword, and the keyword is the same for all of
them even though I have the rand() function included.
This is called "qryADMIn random keywords"
SELECT keywords.pother3, Rnd(1*Second([keywordid]))*Rnd([keywordid]) AS
sortid FROM keywords;
Then I run this update query
UPDATE products, [qryADMIn random keywords] SET products.suggested_keywords =
[qryADMIn random keywords]![pother3];
I have a database with two tables..Products and Keywords. In the Products
table I have a field named suggested_keywords which is a memo type field and
is currently empty. In the Keywords table, I have about 1000 records. Each
records has an unique keyword value.
What I am trying to accomplish is to update the suggested_keywords field in
all existing Products records with 10 random keyword values each, from the
Keywords table. They would be separated by a comma within that field.
Obviously, each suggested_keywords field in every product record would have a
different combined value because it would update with random values.
I have tried several queries and VBA code samples found on DBforums and other
sites without any success.
Can anyone assist with this or provide some advise? Thanks.
The code below is from two queries I tried using. However, the queries update
all records with only one keyword, and the keyword is the same for all of
them even though I have the rand() function included.
This is called "qryADMIn random keywords"
SELECT keywords.pother3, Rnd(1*Second([keywordid]))*Rnd([keywordid]) AS
sortid FROM keywords;
Then I run this update query
UPDATE products, [qryADMIn random keywords] SET products.suggested_keywords =
[qryADMIn random keywords]![pother3];