Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The users of my main form have requ 1

Status
Not open for further replies.

HighLightUK

Technical User
Mar 4, 2003
20
GB
The users of my main form have requested a change to the way it works when selecting a button which creates a new record.

Essentially, the users open the form initially from a menu. At this point the form is blank except for its default values (which is fine).

After they populate the form and save the records to the underlying tables, the users click on a 'New Record'command button. This clears all of their input ready for the next record.

However, they want four fields to show the information that they previously entered. This is because the values in these specific fields can be replicated many times before it changes.

The fields must be overwritable if the information has changed.

The four fields are named:

JobTypeID (a cbo box)
JobDescID (a cbo box)
COrder (a text field)
RecDate (a date field)

Any help on this would be appreciated.

Also, when the 'New Record' button is clicked, this command button retains the focus requiring a further click into the JobTypeID field (the first user field) before input can commence. How can I get the focus switched to this field automatically?

Thanks
 
Hi HighlightUK

An easy way to do this would be to create four hidden unbound fields on your form, and in the AfterUpdate event of each appropriate visible field (JobTypeID, JobDescID, COrder, RecDate) set one of the hidden field's to the same value.

So, something like this for each field ...
Code:
Me.MyHiddenField=Me.JobTypeID

Then, in the
Code:
OnCurrent
form event you could have something like ...

Code:
If IsNull(Me.MyHiddenField)=False Then
Me.JobTypeID=Me.MyHiddenField
End If

... which provides the previous value entered (if there was one) when you move to a new record.

As for the focus, in the
Code:
OnClick
event for the button you could have
Code:
Me.MyChosenField.SetFocus
.

Regards

Mac
 
Hey Mac,

Thanks for the help, it worked a treat! I kind of went 'Doh' to myself when I saw your SetFocus answer, I should have known that myself... must have been working too long on this damn database!

Thanks again,

HighLightUK
 
Hi HighlightUK

Glad to be of assistance - thanks for the star.

My sympathies - my 'Doh!' moments are legion!!!

Regards

Mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top