Tab Control

A

alex

I'm not sure if anyone has tried or needed to do this...

I have a Form already built and I want to add another Form to it (not
a subForm).

I want to create two Forms separated by tabs. I think this is fairly
straight forward from scratch, but I have no idea how to copy the
preexisting Form onto one tab and then create a new Form on the second
tab...any ideas?

alex
 
R

Rick Brandt

alex said:
I'm not sure if anyone has tried or needed to do this...

I have a Form already built and I want to add another Form to it (not
a subForm).

I want to create two Forms separated by tabs. I think this is fairly
straight forward from scratch, but I have no idea how to copy the
preexisting Form onto one tab and then create a new Form on the second
tab...any ideas?

A form is a form and adding a TabControl does not magically make it into two
forms. You would need to place your existing controls on the first page of the
TabControl (cut and paste) and then use a subform on the second page of the
TabControl.

If you leave the MasterLink and ChildLink properties of the subform control
empty then the subform will act independently of the main form.
 
A

alex

A form is a form and adding a TabControl does not magically make it into two
forms. You would need to place your existing controls on the first page of the
TabControl (cut and paste) and then use a subform on the second page of the
TabControl.

If you leave the MasterLink and ChildLink properties of the subform control
empty then the subform will act independently of the main form.

Thanks Rick.

I cut and pasted the preexiting Form on the first page, then pasted
the same Form on the second tab.

What I'm trying to do is create one Form for data entry and another to
view records in the table. I'm certainly no MVP, but this seems an
adequate way to data enter then view (on a rare occasion if needed)
while keeping the data entry Form locked tight. I tried creating a
combo box lookup on the original form, but it was set to data entry
and wouldn't view the old records. Let me know what you think.

alex
 
R

Rick Brandt

alex said:
Thanks Rick.

I cut and pasted the preexiting Form on the first page, then pasted
the same Form on the second tab.

What I'm trying to do is create one Form for data entry and another to
view records in the table. I'm certainly no MVP, but this seems an
adequate way to data enter then view (on a rare occasion if needed)
while keeping the data entry Form locked tight. I tried creating a
combo box lookup on the original form, but it was set to data entry
and wouldn't view the old records. Let me know what you think.

Do you mean you created two subforms (one on each page) or that you pasted the
controls twice onto each page?

It is relatively easy to use the same form for both viewing and editing while
controlling when the latter is allowed. What are you trying to gain with the
second form?
 
A

alex

Do you mean you created two subforms (one on each page) or that you pasted the
controls twice onto each page?

It is relatively easy to use the same form for both viewing and editing while
controlling when the latter is allowed. What are you trying to gain with the
second form?

I was trying to gain viewing capabilities...and yes I pasted the
controls twice (which doesn't work that well as I'm finding out).

Can you tell me how to allow users to view and edit on the same Form
while allowing only data entry of new records?

I.e., allows users to enter a new record; once it's saved, it's
locked; while also allowing them to search and view 'old' records.
 
R

Rick Brandt

alex said:
I was trying to gain viewing capabilities...and yes I pasted the
controls twice (which doesn't work that well as I'm finding out).

Can you tell me how to allow users to view and edit on the same Form
while allowing only data entry of new records?

I.e., allows users to enter a new record; once it's saved, it's
locked; while also allowing them to search and view 'old' records.

AllowAdditions = Yes
AllowEdits = No
AllowDeletes = No

These are all form properties.
 
A

alex

AllowAdditions = Yes
AllowEdits = No
AllowDeletes = No

These are all form properties.

Thanks Rick; now, how can users search for records using a combo box
or other vehicle?
 
R

Rick Brandt

alex said:
Thanks Rick; now, how can users search for records using a combo box
or other vehicle?

If you want that leave AllowEdits = Yes and instead set the Locked property of
all bound controls. You can test the NewRecord property in the form's Current
event to remove the Locks for new record entry.
 
A

alex

If you want that leave AllowEdits = Yes and instead set the Locked property of
all bound controls. You can test the NewRecord property in the form's Current
event to remove the Locks for new record entry.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com- Hide quoted text -

- Show quoted text -

Thanks Rick...
I changed AllowEdit to Yes and locked all bound controls (now I'm
unable to enter anything)
You lost me at the NewRecord property...Does this require a little VBA?
 
R

Rick Brandt

alex said:
Thanks Rick...
I changed AllowEdit to Yes and locked all bound controls (now I'm
unable to enter anything)
You lost me at the NewRecord property...Does this require a little VBA?

Yes. What I do is give all the controls I want to manipulate a common entry in
their Tag property ("Lock" for example). Then in the current event...

Dim cnt as control

If Me.NewRecord Then
For Each cnt in Me
If cnt.Tag = "Lock" Then cnt.Locked = False
Next cnt
Else
For Each cnt in Me
If cnt.Tag = "Lock" Then cnt.Locked = True
Next cnt
End If
 
A

alex

Yes. What I do is give all the controls I want to manipulate a common entry in
their Tag property ("Lock" for example). Then in the current event...

Dim cnt as control

If Me.NewRecord Then
For Each cnt in Me
If cnt.Tag = "Lock" Then cnt.Locked = False
Next cnt
Else
For Each cnt in Me
If cnt.Tag = "Lock" Then cnt.Locked = True
Next cnt
End If

Thanks RIck; I'll give this a try (I didn't know about the Tag)
Now, when you say current event, do you mean the onCurrent property?
 
R

Rick Brandt

alex said:
Thanks RIck; I'll give this a try (I didn't know about the Tag)
Now, when you say current event, do you mean the onCurrent property?

OnCurrent is the event property you see in the property sheet where you enter
[Event Procedure]. The actual event is name Current.
 
Top