A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open a record on a form depending on the record of another form



 
 
Thread Tools Display Modes
  #1  
Old January 13th, 2010, 02:02 PM posted to microsoft.public.access.gettingstarted
Tony[_27_]
external usenet poster
 
Posts: 15
Default Open a record on a form depending on the record of another form

I have 2 forms: A client entry form and a another form with an included
subform.

Both forms have common fields from the client table: clientid name and dob.
The subform has the fields clientid and attendance date.

I have no problem with the 2nd form with its subform as the clientid syncs
without any problem.
As it is opened by an event procedure from the client entry form with the VB
code: DoCmd.OpenForm "frm_client_dates", acNormal I would like it to go to
the current record in the client entry form to save people from doing a
search and from them putting data into the wrong record.

Thank you

  #2  
Old January 13th, 2010, 02:41 PM posted to microsoft.public.access.gettingstarted
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Open a record on a form depending on the record of another form

Tony,
If I understand correctly...
Use the Where argument of the OpenForm method.
(acNormal is assumed in the OpenForm method, so no need to
include it.)
Use your own object names, and the code is all on one line.
Leave the "calling" form open.
Assuming ClientID is numeric
DoCmd.OpenForm "frm_client_dates", , , "ClientID = " & Me.ClientID
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"Tony" wrote in message
...
I have 2 forms: A client entry form and a another form with an included
subform.

Both forms have common fields from the client table: clientid name and
dob.
The subform has the fields clientid and attendance date.

I have no problem with the 2nd form with its subform as the clientid syncs
without any problem.
As it is opened by an event procedure from the client entry form with the
VB code: DoCmd.OpenForm "frm_client_dates", acNormal I would like it to
go to the current record in the client entry form to save people from
doing a search and from them putting data into the wrong record.

Thank you



  #3  
Old January 14th, 2010, 12:15 AM posted to microsoft.public.access.gettingstarted
Tony[_27_]
external usenet poster
 
Posts: 15
Default Open a record on a form depending on the record of another form

Thanks Al, ClientID is a text field of 25chrs so I get a data type mismatch
error 3464.


"Al Campagna" wrote in message
...
Tony,
If I understand correctly...
Use the Where argument of the OpenForm method.
(acNormal is assumed in the OpenForm method, so no need to
include it.)
Use your own object names, and the code is all on one line.
Leave the "calling" form open.
Assuming ClientID is numeric
DoCmd.OpenForm "frm_client_dates", , , "ClientID = " & Me.ClientID
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"Tony" wrote in message
...
I have 2 forms: A client entry form and a another form with an included
subform.

Both forms have common fields from the client table: clientid name and
dob.
The subform has the fields clientid and attendance date.

I have no problem with the 2nd form with its subform as the clientid
syncs without any problem.
As it is opened by an event procedure from the client entry form with the
VB code: DoCmd.OpenForm "frm_client_dates", acNormal I would like it to
go to the current record in the client entry form to save people from
doing a search and from them putting data into the wrong record.

Thank you




  #4  
Old January 14th, 2010, 01:37 AM posted to microsoft.public.access.gettingstarted
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Open a record on a form depending on the record of another form

Tony,
Try...
DoCmd.OpenForm "frm_client_dates", , , "ClientID = ' " & Me.ClientID & " ' "
(I added spaces in the quotes for clarity - remove them in your code)
DoCmd.OpenForm "frm_client_dates", , , "ClientID = '" & Me.ClientID & "'"

Cut and Paste your code in your reply, if you still have problems.
Hopefully, this should do it...
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


"Tony" wrote in message
...
Thanks Al, ClientID is a text field of 25chrs so I get a data type
mismatch error 3464.


"Al Campagna" wrote in message
...
Tony,
If I understand correctly...
Use the Where argument of the OpenForm method.
(acNormal is assumed in the OpenForm method, so no need to
include it.)
Use your own object names, and the code is all on one line.
Leave the "calling" form open.
Assuming ClientID is numeric
DoCmd.OpenForm "frm_client_dates", , , "ClientID = " & Me.ClientID
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

"Tony" wrote in message
...
I have 2 forms: A client entry form and a another form with an included
subform.

Both forms have common fields from the client table: clientid name and
dob.
The subform has the fields clientid and attendance date.

I have no problem with the 2nd form with its subform as the clientid
syncs without any problem.
As it is opened by an event procedure from the client entry form with
the VB code: DoCmd.OpenForm "frm_client_dates", acNormal I would like
it to go to the current record in the client entry form to save people
from doing a search and from them putting data into the wrong record.

Thank you






  #5  
Old January 14th, 2010, 03:42 AM posted to microsoft.public.access.gettingstarted
Tony[_27_]
external usenet poster
 
Posts: 15
Default Open a record on a form depending on the record of another form

Thank you very much, it works as you said it should.
I am left with one small problem:
The first attendance date is part of the client table while the subsequent
ones end up on the dates table.
I would like all the dates to be recorded on the dates table.

Both tables are linked by ClientID and the "Attend_dates" variable is on
both tables.


"Al Campagna" wrote in message
...
Tony,
Try...
DoCmd.OpenForm "frm_client_dates", , , "ClientID = ' " & Me.ClientID & " '
"
(I added spaces in the quotes for clarity - remove them in your code)
DoCmd.OpenForm "frm_client_dates", , , "ClientID = '" & Me.ClientID & "'"

Cut and Paste your code in your reply, if you still have problems.
Hopefully, this should do it...
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


"Tony" wrote in message
...
Thanks Al, ClientID is a text field of 25chrs so I get a data type
mismatch error 3464.


"Al Campagna" wrote in message
...
Tony,
If I understand correctly...
Use the Where argument of the OpenForm method.
(acNormal is assumed in the OpenForm method, so no need to
include it.)
Use your own object names, and the code is all on one line.
Leave the "calling" form open.
Assuming ClientID is numeric
DoCmd.OpenForm "frm_client_dates", , , "ClientID = " & Me.ClientID
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

"Tony" wrote in message
...
I have 2 forms: A client entry form and a another form with an included
subform.

Both forms have common fields from the client table: clientid name and
dob.
The subform has the fields clientid and attendance date.

I have no problem with the 2nd form with its subform as the clientid
syncs without any problem.
As it is opened by an event procedure from the client entry form with
the VB code: DoCmd.OpenForm "frm_client_dates", acNormal I would like
it to go to the current record in the client entry form to save people
from doing a search and from them putting data into the wrong record.

Thank you






  #6  
Old January 14th, 2010, 10:23 AM posted to microsoft.public.access.gettingstarted
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Open a record on a form depending on the record of another form

Tony,
That doesn't seem to make sense.
Give me just the pertinent table fields in each table, with some
sample data.
Given ONE Client vs MANY AttendDates, all aattendance dates
should be in the tblAttendDates.
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


"Tony" wrote in message
...
Thank you very much, it works as you said it should.
I am left with one small problem:
The first attendance date is part of the client table while the subsequent
ones end up on the dates table.
I would like all the dates to be recorded on the dates table.

Both tables are linked by ClientID and the "Attend_dates" variable is on
both tables.


"Al Campagna" wrote in message
...
Tony,
Try...
DoCmd.OpenForm "frm_client_dates", , , "ClientID = ' " & Me.ClientID & "
' "
(I added spaces in the quotes for clarity - remove them in your code)
DoCmd.OpenForm "frm_client_dates", , , "ClientID = '" & Me.ClientID & "'"

Cut and Paste your code in your reply, if you still have problems.
Hopefully, this should do it...
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."


"Tony" wrote in message
...
Thanks Al, ClientID is a text field of 25chrs so I get a data type
mismatch error 3464.


"Al Campagna" wrote in message
...
Tony,
If I understand correctly...
Use the Where argument of the OpenForm method.
(acNormal is assumed in the OpenForm method, so no need to
include it.)
Use your own object names, and the code is all on one line.
Leave the "calling" form open.
Assuming ClientID is numeric
DoCmd.OpenForm "frm_client_dates", , , "ClientID = " & Me.ClientID
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

"Tony" wrote in message
...
I have 2 forms: A client entry form and a another form with an included
subform.

Both forms have common fields from the client table: clientid name and
dob.
The subform has the fields clientid and attendance date.

I have no problem with the 2nd form with its subform as the clientid
syncs without any problem.
As it is opened by an event procedure from the client entry form with
the VB code: DoCmd.OpenForm "frm_client_dates", acNormal I would like
it to go to the current record in the client entry form to save people
from doing a search and from them putting data into the wrong record.

Thank you








 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.