Update new form with values from previous record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,

I have done several searches through the discussion groups and Google for an
answer but don't seem to be looking in the right place.

I have created a database that stores personal information and questions
from people who call my office. An operator who answers the phone fills in
information like first name, last name, address etc on an Access form. There
is a primary key (autonumber) with each entry.

A piece of functionality that I have been asked to add has to do with
callers who have more than one complaint. If someone has multiple
complaints, my operators would like a button that opens a new form with the
information from the caller they have on the phone already populated so they
don't have to enter it again.

I have used the DLast (I know that it's not the best way to do things :) )
function to insert the entries from the previous record onto the new form.
Unfortunately, when the new form is saved, the boxes that use the DLast
function have no data in them.

I'm certain there is a better approach to this. If someone could give me a
suggestion or point me in the right direction, it would be greatly
appreciated.
 
You can try my post in Forms Coding, the subject "Copy record information to
another record in Access " mybe youll find it usefull.
 
form1 is your main form and form2 is your new form

private sub commandX_click()
dim namef1 as string,surnamef1 as string,addresf1 as string
namef1=forms!form1.[name]
surnamef1=forms!form1.[surname]
addresf1=forms!form1.[addres]
DoCmd.OpenForm "Form2", acNormal, "", "", acAdd, acNormal
forms!form2.setfocus
forms!form2.[name]=namef1
forms!form2.[surname]=surnamef1
forms!form2.[addres]=addresf1
End Sub
 
Hi,

Thank you both for your replies.

After fiddling around with Ofer and AccessMonsters options and doing some
tweaking to get it to work with my database, I think I finally have this
problem ironed out.

I appreciate your help.
 
Any time

James said:
Hi,

Thank you both for your replies.

After fiddling around with Ofer and AccessMonsters options and doing some
tweaking to get it to work with my database, I think I finally have this
problem ironed out.

I appreciate your help.

t t via AccessMonster.com said:
form1 is your main form and form2 is your new form

private sub commandX_click()
dim namef1 as string,surnamef1 as string,addresf1 as string
namef1=forms!form1.[name]
surnamef1=forms!form1.[surname]
addresf1=forms!form1.[addres]
DoCmd.OpenForm "Form2", acNormal, "", "", acAdd, acNormal
forms!form2.setfocus
forms!form2.[name]=namef1
forms!form2.[surname]=surnamef1
forms!form2.[addres]=addresf1
End Sub
 
Back
Top