How to clear the values?

G

Guest

I have a form in which I have 4 checkboxes and a textbox controls. When the
user opens the forms, he/she will select one of these checkboxes and then
enter a number corresponding; i.e., a score into that textbox. When I test
the form, I make a check on one checkbox and enter the number in the textbox
and move to the next record. In the next record, the values I just entered
for the previous record are still there. I don't want to have those values
appear on the following record. This second record should be empty ready for
the data entry. And then when one wants to view a particular record; i.e.,
click the back button on the navigation bar, that record should show up with
the entered data. Can you show me how to do that?
Thank you
 
J

Jeff L

If you wish to save your scores then you need to have the field on your
form bound to a field in your table. Based on your description, it
sounds like your textbox in unbound. To set the textbox to a field in
your table, double click the text box so that the properties window
opens. Click the Data tab and in the Control Source box, put the name
of the field in your table that you wish to save the score.
 
G

Guest

Hi Expert,
Thank you for your help. Right now, I am still confused between data entry
in the form or to view data on the form. I know that if I want data entry, I
would go to Data Entry property and say, "Yes". I also know that if I want my
users to view data, I would bound the fields on the form with the control
source like you said.

Is there any way to do both, data entry and view data on the same form? Or
should I create a switchboard on which I create two items for user selection,
a data entry form and a view form?

In my case, I have a main form that its control source is a query. This
query has all information about, say, students's name, teacher's name, etc. I
also have a subform that links to the main form by studentID. On this
subform, I have all empty fields waiting for data entry; i.e., test scores.
As you can see, data is ready in the main form, but not in the subform. What
should I do in this case for data entry and for viewing the data that are
already entered into the subform?
Thank you in advance for your help.
 
K

Keith Wilby

Tim said:
Hi Expert,
Thank you for your help. Right now, I am still confused between data entry
in the form or to view data on the form. I know that if I want data entry,
I
would go to Data Entry property and say, "Yes". I also know that if I want
my
users to view data, I would bound the fields on the form with the control
source like you said.

Either way you would have bound controls.
Is there any way to do both, data entry and view data on the same form?

Yes, set the "data entry" property to "no" - all this property does is hide
existing records when set to "yes". You could always use code and/or
security permissions to limit the user's ability to edit/delete existing
records.

HTH - Keith.
www.keithwilby.com
 
G

Guest

Hi Expert,
If I set the "data entry" property to "no" like you said, then all data that
are bound will show up on the form. How about I want data entry? As I said in
the previous post, I have a subform that are ready for data entry. If I set
the data entry, "yes" then the users will be able to enter data into the
first record and then click the navigation button to go to the next. If they
want to go back to view the data, there is nothing there to view. What should
I do in this case to help the users to view data they just entered.

Thank you,
tim

:

Question: Is there any way to do both, data entry and view data on the same
form?
 
J

John Vinson

Hi Expert,
If I set the "data entry" property to "no" like you said, then all data that
are bound will show up on the form. How about I want data entry? As I said in
the previous post, I have a subform that are ready for data entry. If I set
the data entry, "yes" then the users will be able to enter data into the
first record and then click the navigation button to go to the next. If they
want to go back to view the data, there is nothing there to view. What should
I do in this case to help the users to view data they just entered.

Two points:

The "Data Entry" property does in fact let the user view the data that
they've just entered - but ONLY that data. If they close the form and
reopen it, they can't see anything other than the blank "new record".

And it is *NOT* necessary to set the Data Entry property on a form in
order to enter data. You can enter data on any form, so long as its
recordsource is updateable and you have the Allow Additions property
set to true. You might want to just put code in the Form's Load event:

Private Sub Form_Load(Cancel as Integer)
DoCmd.GoToRecord acForm, Me.Name, acNewRecord
End Sub

to display all the existing records but jump to the new record when
the form is opened.

John W. Vinson[MVP]
 
K

Keith Wilby

Tim said:
Hi Expert,
If I set the "data entry" property to "no" like you said, then all data
that
are bound will show up on the form. How about I want data entry? As I said
in
the previous post, I have a subform that are ready for data entry. If I
set
the data entry, "yes" then the users will be able to enter data into the
first record and then click the navigation button to go to the next. If
they
want to go back to view the data, there is nothing there to view. What
should
I do in this case to help the users to view data they just entered.

Ah, so you want users to see only their own records? Then you need a method
of recording their identities and filtering on that identity when the form
opens. Have a look at the "environ" property in the help. If you record
the user's network ID when they add a record you could then filter for it
when the form opens.

HTH - Keith.
www.keithwilby.com
 
A

AccessVandal via AccessMonster.com

How about a button or a on click event to change the “Data Entry�

Create a Sub in a module as below,

Public Sub ChangeDataEntry(strFormName As String, _
strDataEntry As String, booDataEntry As Boolean)

Dim frm As Form
Dim prop As Property

For Each frm In Forms
If frm.Name = strFormName Then
‘Debug.Print frm.Name
For Each prop In frm.Properties
If prop.Name = strDataEntry Then
‘Debug.Print prop.Value
prop.Value = booDataEntry
‘Debug.Print prop.Value
‘Debug.Print prop.Name
End If
Next prop
End If
Next frm

End Sub

The on click event to change “Data Entry†to “Yesâ€

Call ChangeDataEntry(“YourFormNameâ€, “DataEntryâ€, True)

For the next control event to change "Data Entry" to "No"

Call ChangeDataEntry(“YourFormNameâ€, “DataEntryâ€, False)

Tim wrote:
 
G

Guest

Thank you for your code. That's nice to have something like that to deal with
data entry. In the other hand, I have tried to use the form's properties. On
its properties, I said "Yes" for Allow Edits, Allow Deletes, and Allow
Additions, but I say, "No" for Data Entry. That way, I can enter data and it
seems work as expected.
I hope you will say it's OK to do that way.
Thank you, tim
 
A

AccessVandal via AccessMonster.com

Tim,

Why don’t you use the code to include “AllowEdits†and “AllowDeletes�

Use Select Case like,

Select Case prop.Name
Case “AllowEditsâ€
prop.Value = True ‘Yes = True --- No = False
Case “AllowDeletesâ€
prop.Value = False
Case “DataEntryâ€
prop.Value = False
End Select

Allowing users to edit the form’s properties directly is not a good idea.
If you need to do that, create buttons events for the users.
I’m sure you don’t want users to mess up your Forms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top