Senin, 12 Desember 2016

Re: [MS_AccessPros] Re: Data Type for Mixed Data

 

Another unsuccessful hour.  This VBA code is killing me but I am learning.

The procedure under form current is not working.  A couple of times I received an error saying invalid use of Null; then the last time I got a message saying something about not recognizing the Locked property.  When I try to use the "help" system to type the statement, the "locked" property is not a choice for the control.

The other procedure works fine.

Thank you for all your help.


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

David-

I recommend you use a Continuous form - you'll have much more control over the layout.

These both go in the subform module:

Private Sub Form_Current()

    If Me.Numeric Then
        Me.ResultsTxt.Locked = True
        Me.ResultsDec.Locked = False
    Else
        Me.ResultsTxt.Locked = False
        Me.ResultsDec.Locked = True
    End If

End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

    If Me.Numeric Then
        If IsNull(Me.ResultsDec) Then
            MsgBox "You must enter a result in the Decimal field."
            Cancel = True
        End If
    Else
        If Len(Me.ResultsTxt & "") = 0 Then
            MsgBox "You must enter a result in the Text field."
            Cancel = True
        End If
     End IF
End Sub




John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Dec 11, 2016, at 2:10 PM, David Pratt david.pratt@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



OK, that is an excellent idea!  What a resource you are.

However, I also have the issue with data that needs a < or > input, when the data is below or above the detection limit of the test.  Can you guide me further through doing this?

In my tblServiceReportDetails, where I now only have one Results field which is a ShortText, I will have to modify that table so there is both a ResultsTxt field and a ResultsDec field.

In my Parameters table I will add two descriptive fields
  • One field is a Yes/No named Numeric with default YES
  • One field is named Comparator.  It needs to be a List with choices of "=, <, > "

The input form will contain the Comparator field and the user will have to select the comparator for each result, but the default is "=" so input is easy.  I probably will not even include a Tab Stop on that field since it is seldom that the Comparator is anything other than "=".  Any reports will need to concatenate the Comparator field and Result field, but hide the comparator if the comparator is "=", and also hide the Comparator if the Result is a text.  I will have to delay thinking about how to do this until later.

For now I need more guidance on the input form (datasheet based on tblServiceReportDetails).  If the Parameter in the current record has Numeric = Yes, I want to force the user to input into the ResultsDec field, and if the Parameter in the current record has Numeric = No, I want to force the user to input into the ResultsTxt field.  Can you give more details on how to code this and on what Event?

Thank you,
David






__._,_.___

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

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