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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to syncronize a datasheet form and single form?



 
 
Thread Tools Display Modes
  #1  
Old June 13th, 2004, 03:41 AM
Sandra
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

At the top of a tabbed form I have a datasheet view of a
table (so that I can scroll through a complete list). At
the bottom of the tabbed form is a single entry form of
the same table (this is to enter or edit the record).

Is there a way to click (or dblclick) on a record line in
the datasheet form at the top and have the input form at
the bottom sync with the selected record?

Thanks,

Sandra G


  #2  
Old June 13th, 2004, 04:25 AM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

Sure. Try the following:

You have 2 child forms.

The first form is the continues form you place into the exiting form.

In this sub-form that shows this datasheet view, you
place the following command to make the child forms follow this form.

me.Parent.MyDetailInfoform.Requery

In the link child/master settings for this details form, you place

linkChildFields main_id (whatever is the name of the field in
this sub-form that is used to relate back to the parent table)
LinkMasterFields [MasterForm].[form].[ID]


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


  #3  
Old June 14th, 2004, 05:08 AM
Sandra
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

Thank you so much for your reply! I'm sorry, I am really
a novice, can you be more specific, I don't understand
where to put the first statement Me.Parent....

The name of the table for both form views is Donations.
The name of the form that is in datasheet view is
frmDonationsList. The name of the form that is the
single input form is named frmDonations.

Thank you again for your help,
Sandra
-----Original Message-----
Sure. Try the following:

You have 2 child forms.

The first form is the continues form you place into the

exiting form.

In this sub-form that shows this datasheet view, you
place the following command to make the child forms

follow this form.

me.Parent.MyDetailInfoform.Requery

In the link child/master settings for this details form,

you place

linkChildFields main_id (whatever is the

name of the field in
this sub-form that is used to relate back to the parent

table)
LinkMasterFields [MasterForm].[form].[ID]


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


.

  #4  
Old June 14th, 2004, 06:52 PM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

My sorry, I actually did NOT mention where to put the requery command.

Ok, the me.Parent goes in the sub-frms on-current event.

I would just open the sub-form in design mode (no need to open the parent
form).

Then, in the forms on-current event, you add:

me.Parent.MyDetailInfoform.Requery

Note that MyDetailInfoForm is the name of the sub-form control for the child
records form.

So, we are going to put the above requery in the frmDonationsList on-current
event

me.Parent.frmDonations.Requery

Note that the name of the sub-form control DOES NOT have to be the same name
as the form (and often it is not).

So, check the name of the sub-form control used to display the frmDonations


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


  #5  
Old June 15th, 2004, 04:15 AM
Sandra
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

WOW!!! Works like a charm. Thank you so very much,
Sandra
-----Original Message-----
My sorry, I actually did NOT mention where to put the

requery command.

Ok, the me.Parent goes in the sub-frms on-current event.

I would just open the sub-form in design mode (no need

to open the parent
form).

Then, in the forms on-current event, you add:

me.Parent.MyDetailInfoform.Requery

Note that MyDetailInfoForm is the name of the sub-form

control for the child
records form.

So, we are going to put the above requery in the

frmDonationsList on-current
event

me.Parent.frmDonations.Requery

Note that the name of the sub-form control DOES NOT have

to be the same name
as the form (and often it is not).

So, check the name of the sub-form control used to

display the frmDonations


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


.

  #6  
Old June 15th, 2004, 06:11 AM
Sandra
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

Uh oh, I thought we had this really nailed, but now I
have discovered a glitch. With this setup I cannot do a
new entry in the single view form because the Child and
Master fields have been changed from the PK of the table
of donations to the continuous subform.

My thought was to have another identical single subform
for new entries, with the source and Child/Master fields
linked to the donations table, and have this form hidden
behind the other until you click the NEW button on the
visible subform. I have this accomplished, but I can't
seem to get the right action when you click the NEW
button. What I have is:

Private Sub NewRecord_Click()
On Error GoTo Err_NewRecord_Click
Forms!DonationsNew.Visible = True
Forms!DonationsNew.SetFocus
DoCmd.GoToRecord , , acNewRec
Yada, yada, yada...

But Access tells me it cannot find the form. The control
and the form have the same name - DonationsNew. Is there
a way to do this?

Thanks,
Sandra

-----Original Message-----
My sorry, I actually did NOT mention where to put the

requery command.

Ok, the me.Parent goes in the sub-frms on-current event.

I would just open the sub-form in design mode (no need

to open the parent
form).

Then, in the forms on-current event, you add:

me.Parent.MyDetailInfoform.Requery

Note that MyDetailInfoForm is the name of the sub-form

control for the child
records form.

So, we are going to put the above requery in the

frmDonationsList on-current
event

me.Parent.frmDonations.Requery

Note that the name of the sub-form control DOES NOT have

to be the same name
as the form (and often it is not).

So, check the name of the sub-form control used to

display the frmDonations


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


.

  #7  
Old June 15th, 2004, 07:10 AM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

"Sandra" wrote in message
...
Uh oh, I thought we had this really nailed, but now I
have discovered a glitch. With this setup I cannot do a
new entry in the single view form because the Child and
Master fields have been changed from the PK of the table
of donations to the continuous subform.


Do you want these new records to become a "child" record of the continues
form?


Further, you user interface is going to be a bit confusing. You likely
should be displaying the contact, and have details of the contact display in
a sub-form (this is naturally how ms-access works).

As it is now, users would likely think that they can add records to the
continues form (and they can't). Worse, is when they go to add a record to
the single form, they may very well assume that this record is going to
belong to the CURRENTLY select record in the continuous sub-form. This is
going to be a source of confusing here.

You actually might be better off to turn off the navigation buttons on the
contacts form. I would make the add button LAUNCH another form (as model).
When the user is finished..they can close this form and return to your form.
(you can put some requery code in the close of this form to re-load the
sub-forms).



Private Sub NewRecord_Click()
On Error GoTo Err_NewRecord_Click
Forms!DonationsNew.Visible = True
Forms!DonationsNew.SetFocus
DoCmd.GoToRecord , , acNewRec
Yada, yada, yada...

But Access tells me it cannot find the form.


Remember, sub-forms on a form are simply controls. Each sub-form control can
have ANY form specify for it. You can have 10 sub-form controls on the SAME
form, and EACH sub-form control can be the SAME form! (that means the same
form would appear 10 times on the form as sub-forms). Now, which sub-form
are you referring to? (that is why I spent some time explain that sub-forms
are just controls on form, and the name of the control does NOT have to be
the same as the control).

So, in the above..you can go;

me.MySubFormContorl.Visible = true

Like I say...due to reasons of confusing the user...I would suggest that you
open a new form for data entry..and not try and "switch" that form on the
users (this will get confusing...since they see the details listing..and
will naturally assume a connection between the two).


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


  #8  
Old June 15th, 2004, 10:37 PM
Sandra
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

OK, I think I follow your logic here, and this does make
sense. If I remove the bottom form (the single form)
this would also give me more room on the page to scroll
through records. Once I click on a record, I can use the
On Click event to open up the edit form, or if I click
new I would have it pop up in data entry. This still
provides some protection for my existing records because
the user has to cause an action to be performed before
the data can be edited. The reason I need to have this
second form rather than enter the data in the datasheet
view is because the second form also has 2 subforms for
entering extra data not required in all cases.

Thanks for the advice, I'll see if I can make this work!
Sandra G
-----Original Message-----
"Sandra" wrote in

message
...
Uh oh, I thought we had this really nailed, but now I
have discovered a glitch. With this setup I cannot do

a
new entry in the single view form because the Child and
Master fields have been changed from the PK of the

table
of donations to the continuous subform.


Do you want these new records to become a "child" record

of the continues
form?


Further, you user interface is going to be a bit

confusing. You likely
should be displaying the contact, and have details of

the contact display in
a sub-form (this is naturally how ms-access works).

As it is now, users would likely think that they can add

records to the
continues form (and they can't). Worse, is when they go

to add a record to
the single form, they may very well assume that this

record is going to
belong to the CURRENTLY select record in the continuous

sub-form. This is
going to be a source of confusing here.

You actually might be better off to turn off the

navigation buttons on the
contacts form. I would make the add button LAUNCH

another form (as model).
When the user is finished..they can close this form and

return to your form.
(you can put some requery code in the close of this form

to re-load the
sub-forms).



Private Sub NewRecord_Click()
On Error GoTo Err_NewRecord_Click
Forms!DonationsNew.Visible = True
Forms!DonationsNew.SetFocus
DoCmd.GoToRecord , , acNewRec
Yada, yada, yada...

But Access tells me it cannot find the form.


Remember, sub-forms on a form are simply controls. Each

sub-form control can
have ANY form specify for it. You can have 10 sub-form

controls on the SAME
form, and EACH sub-form control can be the SAME form!

(that means the same
form would appear 10 times on the form as sub-forms).

Now, which sub-form
are you referring to? (that is why I spent some time

explain that sub-forms
are just controls on form, and the name of the control

does NOT have to be
the same as the control).

So, in the above..you can go;

me.MySubFormContorl.Visible = true

Like I say...due to reasons of confusing the user...I

would suggest that you
open a new form for data entry..and not try and "switch"

that form on the
users (this will get confusing...since they see the

details listing..and
will naturally assume a connection between the two).


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


.

  #9  
Old June 15th, 2004, 10:59 PM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

"Sandra" wrote in message
...
OK, I think I follow your logic here, and this does make
sense. If I remove the bottom form (the single form)
this would also give me more room on the page to scroll
through records. Once I click on a record, I can use the
On Click event to open up the edit form, or if I click
new I would have it pop up in data entry. This still
provides some protection for my existing records because
the user has to cause an action to be performed before
the data can be edited.


I like the above very much (good thinking on your part).

I also think that launcing the form will make things easy for your
usres..and you get more screen space too!

You can take a look at some screen shots of forms that do the above....(note
how I have a button on the forms to launch the form to edit in single view).

You can see what I mean he

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm

The code behind those buttons to launch the form is easy....

docmd.openFrom "moredetal",,,"id = " & me.id


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


  #10  
Old June 16th, 2004, 05:24 AM
external usenet poster
 
Posts: n/a
Default How to syncronize a datasheet form and single form?

Well fiddlesticks, one step forward, one step back LOL! I
still have a glitch, so I'll explain what I have now.
On the tabbed form I have just the datasheet subform,
this subform is from a query which filters for the
donation records based upon the PK in master PeoplePlaces
table. This works well because I can see more records.
This form cannot be edited. The OnClick event opens the
DonationsForm form filtered by the donation transaction
PK DID of the clicked record. This form allows for all
the edits, etc. and works just fine. However...I still
have a bit of a problem with new data.

I created a new form DonationsNew, identical to
DonationsForm, but set to DataEntry. I have a NEW button
which opens this form. I can link the first new record
to the PPID record in PeoplePlaces, but after that the
PPID is not being passed to the form. Here's what I have
in the OnClick of the NEW button:

Private Sub NewRecord_Click()
On Error GoTo Err_NewRecord_Click
MyID = Me.PPID
Dim stDocName As String
stDocName = "DonationsNew"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd
Forms!DonationsNew.PPID = MyID
Exit_NewRecord_Click:
Exit Sub

Err_NewRecord_Click:
MsgBox Err.Description
Resume Exit_NewRecord_Click

End Sub

So, I guess what I need now is how to continue to pass
the PPID variable to each new record.

And one last thing will make this really functional...how
do I requery the DonationsList datasheet form after a new
record is added?

Thank you so very much. You have been a Godsend!
Sandra

-----Original Message-----
"Sandra" wrote in

message
...
OK, I think I follow your logic here, and this does

make
sense. If I remove the bottom form (the single form)
this would also give me more room on the page to scroll
through records. Once I click on a record, I can use

the
On Click event to open up the edit form, or if I click
new I would have it pop up in data entry. This still
provides some protection for my existing records

because
the user has to cause an action to be performed before
the data can be edited.


I like the above very much (good thinking on your part).

I also think that launcing the form will make things

easy for your
usres..and you get more screen space too!

You can take a look at some screen shots of forms that

do the above....(note
how I have a button on the forms to launch the form to

edit in single view).

You can see what I mean he

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm

The code behind those buttons to launch the form is

easy....

docmd.openFrom "moredetal",,,"id = " & me.id


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


.

 




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 03:09 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.