Updating a subform field (one table only) - Easy? Version: 2000 (9.0)

dewsbury

Registered User.
Local time
Today, 06:29
Joined
Jul 4, 2008
Messages
57
Hi all,

I have a single table database.
The main form links to a subform.
Both forms only display data from the table "main".

I have a "Button" on each line of the continous subform which when clicked should set the [main].[group]=[main].[id].

This update should occur for the single record ONLY and not the entire table.
There is a unique index on the table [ID].

So have do I finish the syntax below..??


DoCmd.RunSQL "update main set [main].[group]= [main].[File_bar] where ..... "
 
dewsbury,

There is only ONE record to update and it's being displayed on your main form.
You don't need a SQL solution.

Forms!YourMainForm.Group = Me.ID

will do it.

You can also look at referencing it via Me.Parent.Group, but the above syntax will work.

Wayne
 
And, again we have use of an Access Reserved Word (GROUP) which can cause you pain and suffering. I would rename your field to something other than GROUP.

See here for a very comprehensive list of reserved words:
http://www.allenbrowne.com/AppIssueBadWord.html
 

Users who are viewing this thread

Back
Top Bottom