By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,494 Members | 1,502 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,494 IT Pros & Developers. It's quick & easy.

copy multiple fields from one table to another

P: n/a
I have situation where I need to copy multiple records (only certain fields)
from a Rules table to an Events table based on a selection identified in a
combo box. When the selection is made in a parent table, multiple records
in a child table are affected. However, I'm a bit weak on programming
experience. INSERT INTO is not suitable. Any ideas?

When the combo box update property is triggered, the code needs to
accomplish:

IF rules don't exist in Events table, then copy from Rules table
FOR each row needed
create row in Events table for each qualified record in Rules table
copy fields from Rules table to Events table (thinking of using an
append query here)
End For
ELSEIF rules are present in Events table, then update records in Events
table from records in Rules table
FOR each row
update fields from Rules table to Events table (thinking of using an
update query here)
end if

Thanks,
Grant
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"news.hp.com" <gr********@hp.com> wrote in message news:<3f********@usenet01.boi.hp.com>...
I have situation where I need to copy multiple records (only certain fields)
from a Rules table to an Events table based on a selection identified in a
combo box. When the selection is made in a parent table, multiple records
in a child table are affected. However, I'm a bit weak on programming
experience. INSERT INTO is not suitable. Any ideas?

When the combo box update property is triggered, the code needs to
accomplish:

IF rules don't exist in Events table, then copy from Rules table
FOR each row needed
create row in Events table for each qualified record in Rules table
copy fields from Rules table to Events table (thinking of using an
append query here)
End For
ELSEIF rules are present in Events table, then update records in Events
table from records in Rules table
FOR each row
update fields from Rules table to Events table (thinking of using an
update query here)
end if

Thanks,
Grant

If RulesExist=False '<--- you could use an outer join to determine this....
docmd.openQuery "qappAddRules" 'WHERE Rightside table. PK = Null
Else
Docmd.OpenQuery "qupdUpdateRules" 'Where RightsideTable.PK NOT NULL
End If
--Okay, now in something like semi-useful code...
DoCmd.SetWarnings False 'Only _AFTER_ the queries work manually...
DoCmd.OpenQuery "qupdRules"
DoCmd.OpenQuery "qappRules"
DoCmd.SetWarnings True

On Error
Msgbox Err.ErrNo & Err.Description
Err.Clear
Nov 12 '05 #2

P: n/a
OK. You've given me some ideas to munch on...
Thanks, Grant

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf*************************@posting.google.co m...
"news.hp.com" <gr********@hp.com> wrote in message news:<3f********@usenet01.boi.hp.com>...
I have situation where I need to copy multiple records (only certain fields) from a Rules table to an Events table based on a selection identified in a combo box. When the selection is made in a parent table, multiple records in a child table are affected. However, I'm a bit weak on programming
experience. INSERT INTO is not suitable. Any ideas?

When the combo box update property is triggered, the code needs to
accomplish:

IF rules don't exist in Events table, then copy from Rules table
FOR each row needed
create row in Events table for each qualified record in Rules table copy fields from Rules table to Events table (thinking of using an append query here)
End For
ELSEIF rules are present in Events table, then update records in Events
table from records in Rules table
FOR each row
update fields from Rules table to Events table (thinking of using an update query here)
end if

Thanks,
Grant

If RulesExist=False '<--- you could use an outer join to determine

this.... docmd.openQuery "qappAddRules" 'WHERE Rightside table. PK = Null
Else
Docmd.OpenQuery "qupdUpdateRules" 'Where RightsideTable.PK NOT NULL
End If
--Okay, now in something like semi-useful code...
DoCmd.SetWarnings False 'Only _AFTER_ the queries work manually...
DoCmd.OpenQuery "qupdRules"
DoCmd.OpenQuery "qappRules"
DoCmd.SetWarnings True

On Error
Msgbox Err.ErrNo & Err.Description
Err.Clear

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.