Lookup question

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I am using a Macro that calls up an append query to move
data from one table to another. The query prompts the user
to 'name' the records. The name is stored in a new field
in the appended table. There can be more than one record
with this 'name', so it is not a primary key.

How can I make the macro check the 'name' field, and if
that 'name' already exists, prompt the user for a new
name?
 
Use a condition expression similar to this to see if the entered name is
already in the table:

Condition: DCount("*", "TableName", "[NameField]='" & InputBox("Enter the
name:") & "'")>0

The above condition will be True if the entered name is already in the
table.

You'd need to then have the macro loop back around to repeat the above step
(after displaying a message box telling the user that this name is already
in the table) so that the user is again prompted for a name.
 
Back
Top