C
Cameron Piper
I am working on a database in Access 2002 with a windows
and office XP Pro based machine. I have what seems like
a real simple question, but I just haven't been able to
figure it out.
I would like to open a pop-up form and have certain
fields filled in automatically. My google searches have
been littered with how to do this if you are opening
another copy of the same form and you want to copy some
of the fields, but I have yet to find the answer if you
are opening a different form with a different record
source even.
I have two forms linked to two different tables.
tblClient is linked to tblActivity with a field called
ClientID. From frmClient(record source = tblclient), I
would like to be able to click a button and open a "new
activity record," but have the clientID the same as the
primary form. Essentialy I would like to create a new
activity for that client. I tried the following codes to
attempt to accomplish this.
1. linking the fields with a link criteria like so:
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
However, I found that this code will open a form and find
an existing activity where the clientID matches.
2. This code however gave me error 2448:
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Me!ClientID = Forms![frmClient].[ClientID]
I am assuming that I will need to use:
DoCmd.GoToRecord , , acNewRec
to get to the new record but I need to know how to set
the values in the new record to match the previous form.
Can anyone help me along to be able to set these values?
Thank you in advance for your help.
Cameron Piper
CSPiper).Please.No.Spam(@CBBurnet(.Thank.You).com
and office XP Pro based machine. I have what seems like
a real simple question, but I just haven't been able to
figure it out.
I would like to open a pop-up form and have certain
fields filled in automatically. My google searches have
been littered with how to do this if you are opening
another copy of the same form and you want to copy some
of the fields, but I have yet to find the answer if you
are opening a different form with a different record
source even.
I have two forms linked to two different tables.
tblClient is linked to tblActivity with a field called
ClientID. From frmClient(record source = tblclient), I
would like to be able to click a button and open a "new
activity record," but have the clientID the same as the
primary form. Essentialy I would like to create a new
activity for that client. I tried the following codes to
attempt to accomplish this.
1. linking the fields with a link criteria like so:
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
However, I found that this code will open a form and find
an existing activity where the clientID matches.
2. This code however gave me error 2448:
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Me!ClientID = Forms![frmClient].[ClientID]
I am assuming that I will need to use:
DoCmd.GoToRecord , , acNewRec
to get to the new record but I need to know how to set
the values in the new record to match the previous form.
Can anyone help me along to be able to set these values?
Thank you in advance for your help.
Cameron Piper
CSPiper).Please.No.Spam(@CBBurnet(.Thank.You).com