Inserting Data into Existing Record - part 2

G

Guest

Hi again,

Ok, unfortunately, the below (which originally worked for me) is now no
longer working - the problem appears to be that the initial record in the
table was not created yet, and therefore when the billing information was put
into form2, it inserts 2 records into table1 - one for the shipping info on
form1 and one for the billing info on form2. However, if I go into the
record AFTER it has been entered and then click on form2, I can get it to
update the current record.

Is there a way I can have, upon creation of a new record, form1 and form2
update table1 to the same record without having to go back into the record
after creation?

Thanks!
You can always put another tab on Form1 and put the billing fields in there.

If you want to use two forms, your two forms should have the same datasource
(table1 ). The Shipping info fields are in Form1, the Billing fields in
Form2. A button on Form1 is used to open form 2. The code in the button
should be something like this:

Dim strCriteria As String
strCriteria = "[Order_ID] = " & Me.Order_ID
DoCmd.OpenForm "form2 ", , , strCriteria, , acDialog

You do not need an update query.

Good luck!

Gary Dolliver said:
Hello, thanks for the reply, here are the answers below:


Yes, I have one table (holding both billing and shipping info) being updated
by 2 forms. Record locks are off


I do have both billing and shipping info in one table. I cannot use a tab
control as it is already set up on form1 - unless there is a way to put a tab
control within a tab control?

Am I asking for the impossible? Thanks!
-gary
 
P

Powderfinger

Gary,

See my response below. Did you try putting:

DoCmd.RunCommand acCmdSaveRecord

in the OnClick event of the button in from1 that opens form2?

also,

you must might an AddRecord somewhere in form2, you do not need this.

Gary Dolliver said:
Hi again,

Ok, unfortunately, the below (which originally worked for me) is now no
longer working - the problem appears to be that the initial record in the
table was not created yet, and therefore when the billing information was put
into form2, it inserts 2 records into table1 - one for the shipping info on
form1 and one for the billing info on form2. However, if I go into the
record AFTER it has been entered and then click on form2, I can get it to
update the current record.

Is there a way I can have, upon creation of a new record, form1 and form2
update table1 to the same record without having to go back into the record
after creation?

Thanks!
You can always put another tab on Form1 and put the billing fields in there.

If you want to use two forms, your two forms should have the same datasource
(table1 ). The Shipping info fields are in Form1, the Billing fields in
Form2. A button on Form1 is used to open form 2. The code in the button
should be something like this:

Dim strCriteria As String
strCriteria = "[Order_ID] = " & Me.Order_ID
DoCmd.OpenForm "form2 ", , , strCriteria, , acDialog

You do not need an update query.

Good luck!

Hello, thanks for the reply, here are the answers below:

Let me get this straight, you are using TWO forms to update ONE
table?
Are
there any locks on the forms? (i.e. RecordLocks property) This
should be
set
to "No Locks".

Yes, I have one table (holding both billing and shipping info) being updated
by 2 forms. Record locks are off

Why don't you have fields for Billing info and Shipping info in one table.
You could use a Tab Control if you do not have much room.

I do have both billing and shipping info in one table. I cannot use a tab
control as it is already set up on form1 - unless there is a way to
put a
tab
control within a tab control?

Am I asking for the impossible? Thanks!
-gary


:


Thanks Jeff, and sorry for the lack of info - perhaps you can shed some
light
on making this a little easier for me... ;)

Basically, form1 is a general receiving screen (address info and generic
product info) and form2 is to gather billing information (shipping
information is collected on form1). I do not have this information on
form1
as space is limited and probably 9 out of 10 times it will not be
relavent.
Therefore, I thought a seperate form, activated by a check box on form1
(yes/no - yes opens form, no duplicates shipping info into bill to
fields),
would be able to accomodate this. Ideally, I would like to have
all
of
the
information in one record in table1 (I know I could do this if I seperated
the tables, billing v. shipping, but what would be the fun in that?)

I am using a field Order_ID from table1 to try and keep everything
together

Hope that helps, thanks!
-gary

Let me get this straight, you are using TWO forms to update ONE
table?
Are
there any locks on the forms? (i.e. RecordLocks property) This
should be
set
to "No Locks".

Even so that's not a good way to do it.

Why don't you have fields for Billing info and Shipping info in one table.
You could use a Tab Control if you do not have much room.. Then copy the
Shipping fields to billing when there are the same (i.e. Me.BillingAddress =
Me.ShippingAddress)
 
G

Guest

I just saw your response and it did the trick - this time I tested it
multiple times and can officially say "case closed!" Thanks again!
-gary

Powderfinger said:
Gary,

See my response below. Did you try putting:

DoCmd.RunCommand acCmdSaveRecord

in the OnClick event of the button in from1 that opens form2?

also,

you must might an AddRecord somewhere in form2, you do not need this.

Gary Dolliver said:
Hi again,

Ok, unfortunately, the below (which originally worked for me) is now no
longer working - the problem appears to be that the initial record in the
table was not created yet, and therefore when the billing information was put
into form2, it inserts 2 records into table1 - one for the shipping info on
form1 and one for the billing info on form2. However, if I go into the
record AFTER it has been entered and then click on form2, I can get it to
update the current record.

Is there a way I can have, upon creation of a new record, form1 and form2
update table1 to the same record without having to go back into the record
after creation?

Thanks!
You can always put another tab on Form1 and put the billing fields in there.

If you want to use two forms, your two forms should have the same datasource
(table1 ). The Shipping info fields are in Form1, the Billing fields in
Form2. A button on Form1 is used to open form 2. The code in the button
should be something like this:

Dim strCriteria As String
strCriteria = "[Order_ID] = " & Me.Order_ID
DoCmd.OpenForm "form2 ", , , strCriteria, , acDialog

You do not need an update query.

Good luck!

Hello, thanks for the reply, here are the answers below:

Let me get this straight, you are using TWO forms to update ONE table?
Are
there any locks on the forms? (i.e. RecordLocks property) This should be
set
to "No Locks".

Yes, I have one table (holding both billing and shipping info) being
updated
by 2 forms. Record locks are off

Why don't you have fields for Billing info and Shipping info in one
table.
You could use a Tab Control if you do not have much room.

I do have both billing and shipping info in one table. I cannot use a tab
control as it is already set up on form1 - unless there is a way to put a
tab
control within a tab control?

Am I asking for the impossible? Thanks!
-gary


:


message
Thanks Jeff, and sorry for the lack of info - perhaps you can shed
some
light
on making this a little easier for me... ;)

Basically, form1 is a general receiving screen (address info and
generic
product info) and form2 is to gather billing information (shipping
information is collected on form1). I do not have this information on
form1
as space is limited and probably 9 out of 10 times it will not be
relavent.
Therefore, I thought a seperate form, activated by a check box on
form1
(yes/no - yes opens form, no duplicates shipping info into bill to
fields),
would be able to accomodate this. Ideally, I would like to have all
of
the
information in one record in table1 (I know I could do this if I
seperated
the tables, billing v. shipping, but what would be the fun in that?)

I am using a field Order_ID from table1 to try and keep everything
together

Hope that helps, thanks!
-gary

Let me get this straight, you are using TWO forms to update ONE table?
Are
there any locks on the forms? (i.e. RecordLocks property) This should be
set
to "No Locks".

Even so that's not a good way to do it.

Why don't you have fields for Billing info and Shipping info in one
table.
You could use a Tab Control if you do not have much room.. Then copy the
Shipping fields to billing when there are the same (i.e.
Me.BillingAddress =
Me.ShippingAddress)
 

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