Minggu, 16 April 2017

[MS_AccessPros] Re: Default Values for text box

 

OK, I think I figured out what the problem is.  Controls don't have default values apparently; I guess only fields have default values.  I removed the .DefaultValue and just assigned the text string to the control.  I don't have a good understanding of when to reference a control and when to reference the field behind the control.

So my next question is, once I place that default value into the control, can i manipulate the cursor in that text box so that is on the first zero following the letter?  And then the user would have to back up to change the letter.


---In MS_Access_Professionals@yahoogroups.com, <david.pratt@...> wrote :

I have a form with several text boxes and a combo box.  The last control is a text box (txtEquipmentSort) to enter a sort number for report ordering purposes later in the application.  The sort number must begin with a letter and then is followed by 3 digits.  The next to last control is a combo box with a field named Application Group.  Based on the selection made in cboApplicationGroup, I want to set the default value for txtEquipmentSort control.  this is the code I have in the cboApplicationGroup AfterUpdate Event:

Private Sub cboApplicationGroup_AfterUpdate()
    Select Case cboApplicationGroup.Value
        Case 1 'Boiler
            txtEquipSort.DefaultValue = "B000"
            MsgBox "Boiler"
        Case 3 'Cooling
            txtEquipSort.DefaultValue = "C000"
            MsgBox "Cooling"
        Case 5 ' Process Equipment
            txtEquipSort.DefaultValue = "P000"
        Case 10 'Other
            txtEquipSort.DefaultValue = "A000"
        Case 12 'Wastewater
            txtEquipSort.DefaultValue = "W000"
        Case 13 'External Equipment
            txtEquipSort.DefaultValue = "X000"
        Case Else
            txtEquipSort.DefaultValue = ""
            Me.cboApplicationGroup.SetFocus
    End Select
End Sub

I put the two MsgBox statements in just to see if the Case was working.  I get the correct MsgBox statement but no default value is getting loaded into txtEquipSort.


__._,_.___

Posted by: david.pratt@outlook.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar