Results 1 to 5 of 5
  1. #1
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480

    if text field is ... This is a big one.


    Okay, so I am having a problem. This app is sending data into a website from a txt field on a form... if the search is performed while the field is blank, it runs a query on the site and tries to pull back over 300k clients. Causing stress on the server and a performance issue for many people....

    Essentially I am trying to say, If this txt on this form is blank, then exit sub and end if.

    This does not look right to me. I am fairly new to VBA and I cannot think of the solution.

    Code:
     If Forms("frmMain").txtLMClient <> "" Then
            Exit Sub
            End If

    Here is a bigger part of the code I guess it might help. +

    Code:
     oHub.Document.all.Item("providerAcctSearchForm.providerAcctName").Value = Forms("frmMain").txtLMClient.Value
     
     If Forms("frmMain").txtLMClient <> "" Then
            Exit Sub
            End If
     
       oHub.Navigate "javascript:submitFormWithAction(document.providerAccountSearchSummaryForm, document.providerAccountSearchSummaryForm.form_action, 'ActionSearchProviderAccounts')"
    Basically I do not want the last ohub.navigate to run if that field is blank.... Any help would be appreciated.
    Last edited by redbull; 03-09-2012 at 08:40 AM.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    Code you show exits if value is not an empty string. Wouldn't you rather run the code?

    This deals with the value if it is Null or empty string:

    If Forms!formMain.txtLMClient & "" <> "" Then
    oHub.Navigate "javascript:submitFormWithAction(document.provider AccountSearchSummaryForm, document.providerAccountSearchSummaryForm.form_act ion, 'ActionSearchProviderAccounts')"
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    Quote Originally Posted by June7 View Post
    Code you show exits if value is not an empty string.
    Hmm, that might be the issue. Basically if the field on the form is empty I want to exit sub and end if.


    Code:
    If Forms!formMain.txtLMClient & "" <> "" Then
    exit sub
    end if
    If the app runs the "oHub.Navigate "javascript:submitFormWithAction"
    line with no criteria in the field it really makes a mess of one of the servers. I will try this tomorrow morning and get back to you. thank you for your time.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    Maybe I am missing something, but you are exiting the sub if there IS a value, not if there isn't. Look at my suggested code again.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    Yea, After a few hours of sleep... the whole question is just embarrassing. The code below does what I am looking for.



    If Forms("frmMain").txtLMClient = "" Then
    Exit Sub
    End If

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Include Text in text box with the field
    By TinaCa in forum Reports
    Replies: 2
    Last Post: 10-05-2011, 01:42 PM
  2. Selecting a corresponding table field based on text field.
    By michaeljohnh in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 10:33 AM
  3. Replies: 2
    Last Post: 05-05-2010, 02:52 PM
  4. Split text field into two text fields
    By Grant in forum Access
    Replies: 6
    Last Post: 01-31-2008, 05:52 AM
  5. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums