• WSsantosm

    WSsantosm

    @wssantosm

    Viewing 15 replies - 1 through 15 (of 391 total)
    Author
    Replies
    • in reply to: Select Case #1187933

      Hi,
      strName already has a value applied to it from the form, in this case a company name.

      Thanks,
      Mark

      What have you set strName equal to? The variable needs it’s data from somewhere.

    • in reply to: Select Case #1186749

      Thanks!

      Just in case you ever have a more complicated (more than two-choice) scenario where you’d prefer to use Select Case, note that you can use wildcards within Select Case if you structure it like this:

      Code:
          Dim strX As String
          strX = "porcupine"
          Select Case True
              Case strX Like "porco*"
                  MsgBox "o"
              Case strX Like "porcu*"
                  MsgBox "u"
              Case Else
                  MsgBox "Nope"
          End Select
      
    • in reply to: Select Case #1186694

      Hi Hans,
      Thanks!

      Mark

      You can’t use wildcards in Select Case … End Case.

      Try

      Code:
      If strName Like "*anyname*" Then
        Me.Command123.Visible = True
      Else
        Me.Command123.Visible = False
      End If
      

      or even

      Me.Command123.Visible = (strName Like “*anyname*”)

    • in reply to: Select Case #1186693

      Hi Wendell,
      VBA, but now I see that Hans has said I cannot use wildcards in a select method.

      Thanks,
      Mark

      Mark, is this a Select Case in VBA, or is it a SELECT CASE in T-SQL (SQL Server or equivalent)? The replies have assumed it was in VBA, but from your code, it could well be a view or query in SQL Server.

    • in reply to: Select Case #1186686

      Hi Andrew and Pat,
      What I am looking for is to filter based on a name using wildcards. The name might be something like Acme North, Acme South, Acme West, etc. I tried using:

      case “*Acme*” but it wouldn’t find any of those names.

      Thanks,
      Mark

      Do you mean, if there is anything in the strName variable ?

      If that is the case then this ought to work

      [Code]
      Select Case Len(strName)
      Case 0
      command123.visible = False
      Case Else
      command123.visible = True
      End Select
      [/Code]

      If not you need to clarify what is likely to be in strName, and what you are looking to check

      If you are only looking for one of 2 options though, you could just as easily use an IF

      [Code]
      IF Len(strName) =0 Then
      command123.visible = False
      Else
      command123.visible = True
      End If
      [/Code]

      Indeed in Both cases you could possibly just check for strName=””

    • in reply to: Subform record selection #1180769

      Hi Hans,
      Thanks again!

      I couldn’t get the “nomatch” thing to work but the rest is working. I will play around with it later…

      Thanks,
      Mark

      You can use code like this. I’ve assumed that the code is to be run from the main form:

      Code:
      Dim rst As DAO.Recordset
      Set rst = Me.SubFormName.Form.RecordsetClone
      rst.FindFirst "ID = " & Me.txtFindID
      If rst.NoMatch Then
        Beep
      Else
        ' Move to the record
        Me.SubFormName.Form.Bookmark = rst.Bookmark
        ' Set focus to the subform
        Me.SubFormName.SetFocus
        ' Optional: set focus to a specific control
        Me.SubFormName!SomeControl.SetFocus
      End If
      Set rst = Nothing

      Notes:
      – You need a reference to the Microsoft DAO 3.6 Object Library (if you’re using an .mdb database).
      – Replace SubFormName with the name of your subform as a control on the main form.
      – Replace SomeControl with the name of the control on the subform you want to set focus to (this is optional).
      – Replace “ID = ” & Me.txtFindID with the condition you want to use.

    • in reply to: “Pause” in code #1168689

      Hi Andrew,
      That looks good. I will give it a try.

      Thanks,
      Mark

      Have you tried something like this which was found here – http://www.experts-exchange.com/Web_Develo…Q_11973538.html
      dim startTimer, currentTimer
      dim duration ‘in seconds
      duration=30

      startTimer=timer
      do while currentTimer<(startTimer+duration)
      currentTimer=timer
      Loop

    • in reply to: “Pause” in code #1168668

      Hi Hans,
      OK, no problem. I will keep trying things and if I come across something that works, I will post back.

      Take care,
      Mark

      I meant the Window.setTimeOut mentioned near the end – this will only work for web pages.

      I use VBScript very rarely, and then for very simple things only, so I can’t offer much help.

    • in reply to: “Pause” in code #1168635

      Hi Hans,
      I can try this but “Sleep” is also not in the keyword list. I am now wondering if some sort of “Timer” DO/LOOP would work.

      Thanks,
      Mark

      Does VBScript – sleep command help? (See the replies near the bottom of the thread)

    • in reply to: “Pause” in code #1168627

      That sounds like it may work. Any idea how you would monitor the clock?

      Thanks,
      Mark

      Perhaps you can write a Do loop that simply burns up time doing something useless and monitoring the clock. However, if the goal is to let another process proceed in the background, you may need to find a method similar to Sleep (assuming the equipment is capable of multi-tasking different processes).

    • in reply to: “Pause” in code #1168626

      Hi,
      WScript will not work with VBS 5.5. Do you have any ideas of another way to waste a second or two?

      Thanks,
      Mark

      I can use WScript.Sleep in a .vbs file without problems – see attached sample.

    • in reply to: “Pause” in code #1168524

      Hi Hans,
      I will try but I am not seeing that in the VBS 5.5 command reference.

      Thanks,
      Mark

      I can use WScript.Sleep in a .vbs file without problems – see attached sample.

    • in reply to: “Pause” in code #1168456

      Hi,
      The equipment is a machine that acts like a printer with programmable input. There is an option to run VBScript 5.5 compliant commands with the job file when it runs. Looking at the VBS 5.5 help file I have, that Wscript method is not there, so I am not sure it will work. Any other ideas?

      Thanks,
      Mark

      Not sure what you mean by “a piece of equipment,” but if it runs the Windows Script Host, check out the WScript.Sleep Method. (This method is not part of native VBS.)

    • in reply to: Pasted Text #1167810

      Hi Hans,
      Since this is something we do quite a bit with the DB and it is inefficient in it’s current state, I think I will dive in….

      Thanks,
      Mark

      You can use Automation to control Outlook from Access using VBA – you could read messages in a mail folder, extract and process the subject and/or body of the messages, then move them to another folder.
      This is not extremely difficult, but it requires that you are reasonably familiar with both Access VBA and Outlook VBA.

      See WendellB’s tutorial Automation 101 for an introduction and useful links, and search this forum for Outlook.Application to see examples.

    • in reply to: access 2003 #1167805

      You can try using the

      Me.AllowEdits = True (or false)

      based on conditions for the form. I use this all the time and it works great. You would need to go to the code window for specific event on the form, like On Open for instance, and add the code there.

      Mark

      Hello all, I was wondering if anyone knows how to diable the editing on the form besides turning off the allow edits in the property sheet. Is it possible to turn it off for tha whole form using vb code. Thank you in advance.

    Viewing 15 replies - 1 through 15 (of 391 total)