Code Builder

ath23

Registered User.
Local time
Today, 16:58
Joined
Jan 14, 2001
Messages
12
Hi,

I am modifying designs on a form, which I didnt build the database for, this has proved to be difficult. What I am wrecking my brain over is this:
1. There is a data entry form which involves 15 questions.
2. To avoid re-keying the same data in all questions such as persons name etc, the designer has requested to hit 'Ctrl' and ' key.

This is quite inefficient....I was wondering whether I can create a command button like "Add new record" which on-click will:
1. Display the next record, but with the the information automatically populate the fields.

The information will vary as these are people's names, department etc...therefore the Lookup feature doesn't quite work...

If anyone knows, it would be appreciated to receive a response. Thanks!
 
Let's say you have a control on your form, say storing the date. If you want to remember the value from the previously entered record so you can auomatically fill in this value for the user, you can do the following:

Create the "Add New Record" cmmoand button as you said. But before you display the blank form, set the control's tag property to the value that was entered into the field.
When you display the blank form, make the controls value/text property to be equal to its tag property ( me.dteControl.Value = me.dteControl.Tag)

So if you were entering record 5 and the user entered the date as 15/01/2000, this would be stored in the tag property. When the user clicks on the "Add New Record" command button a blank form is displayed but showing a value of 15/01/2000 as the date control value.

The Tag property is an easy way to remember values when adding many similar value based records.

ntp
 
As an alternative you can do it like this (cut and pasted from my app).

Private Sub txtPW_Exit(Cancel As Integer)

With CodeContextObject

.JobNumber.DefaultValue = """" & .JobNumber & """"
.JobName.DefaultValue = """" & .JobName & """"
.WeekEnding.DefaultValue = """" & .WeekEnding & """"

End With

End Sub

This will fill the next record with the value of the previous record. I don't have the command to start a new record here because I put this on the last record of the form when it exits here it will start a new record and fill in the information. You can add a command to start a new record if you need it.

I have this on the On_Exit event of a control but you could easily put it behind a On_Click for a command button. Other then that you will have to replace the text box names with yours and you should be all set.

[This message has been edited by Talismanic (edited 01-15-2001).]
 
Thankyou all for responding..shall try it now and come back if i can't figure it out....
 
Hi Both,

It didn't seem to work..probably due to my inexperience...glad to learn from the experts!!!

Any other explanations?
 
The real problem is the table design. You should probable break your table into two different tables. One to hold "person" information and the other to hold "job" information. Then you can use a MainForm with a SubForm for data entry/display.
 

Users who are viewing this thread

Back
Top Bottom