Combo Box Keep Data on Command Execution

jwood29

Registered User.
Local time
Today, 15:12
Joined
May 13, 2008
Messages
28
How can I keep the initial elected data on a combo box drop down present after I click Save. It would be nice to keep.
For instance User, Donald Duck goes to the Ticket Form and Enters an older date like 5/1/08, chooses his name, Project, Hours, and Notes. Clicks Save. That days Ticket information gets stored, now if he stays on this form to enter another day or project, Donald Duck has to re-enter his name and Project. Can these values stay until Exit button is executed? I have attached an example of this.

Thanks.

~jwood29
 

Attachments

In your form, you can use the AfterUpdate event of the control holding your data to set the DefaultValue for the field. From that time forward, until you either manually change the data or close your form, the data will be entered automatically in each new record. The code below was written for textboxes, but the same should work for comboboxes. The syntax is slightly different, depending on the datatype of the data:

For Text fields

Code:
Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
  YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value & """"
End If
End Sub
For Numeric fields

Code:
Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
  YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub
For Date fields

Code:
Private Sub YourDateControlName_AfterUpdate()
If Not IsNull(Me.YourDateControlName.Value) Then
  YourDateControlName.DefaultValue ="#" &  Me.YourDateControlName & "#"
End If
End Sub
 
Sweet, Thanks Bunches.

missinglinq. Thank You So Much. Absolutely Amazing. You Nailed it. That is exactly what I was looking For. Used it for Date, Employee, and Project. You Rock. Very Cool. Have a good one!

~jwood29
 

Users who are viewing this thread

Back
Top Bottom