Refreshing data after ado record insert

H

HandA

Hi,

part of my database has 2 tables

tblRecipe (these have a 1 to N relationship with tblRecipe being the 1-side
of it)
tblRecipeIngredient

I have a frmRecipe that shows tblRecipe as a record and a subform for
related tblRecipeIngredient's
I have a drop down--lookup to find recipes--for record navigation.

I have an Add button, and Delete Button and also a "Save As" button which is
to produce a duplicate record("recipe")

I couldn't use Access's built in command wizard duplicate code becuase
tblRecipe has an autonumber PK and also a Recipe_Name that doesn't allow
duplicates. The code generated by the wizard would fail because it would
copy the field Recipe_Name into the new "duplicate record" and violate
indexing rules.

So for that reason I made ADO code to find the record in question, insert a
new one, and then insert all of the same data for tblRecipeIngriedent.

This works fine.
The problem is this.
How do I refresh the lookup dropdown (combobox) and also make it jump to the
new duplicate record--"cloned" record???

I have try

me.requery
mycombo.requery
and many other things and it just doesn't work.

Thanks,

Shane
 
D

Doug Bell

I think that your mycombo.requery is probably working it is just that the
new record has not yet been saved. You could try a docmd.RunCommand
acCmdSaveRecord

by the way you can also use the recordset clone property to find the current
record and then use DAO to create the copy. DAO is not as universal as ADO
and is older technology but it is faster on Jet DBs

And you are wise to not use Wizards (ever).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top