• WSMarkD

    WSMarkD

    @wsmarkd

    Viewing 15 replies - 1,861 through 1,875 (of 1,889 total)
    Author
    Replies
    • in reply to: Combo won’t work with numbers (2KSr1) #572077

      I tested this using an autonumber (primary key) and numeric field as 1st two columns of combo and it worked fine, using same generic code created by wizard. Did not have to convert any numeric values to text. The first column of combo (Autonumber) is set to 0″. Not sure what is causing your problem, but would recommend modifying code created by wizard to something like:

       Private Sub Combo8_AfterUpdate()
          ' Find the record that matches the control.
          Dim rs As DAO.Recordset
          Set rs = Me.Recordset.Clone
          rs.FindFirst "[ID] = " & Me![Combo8]
          Me.Bookmark = rs.Bookmark
          rs.Close
          Set rs = Nothing
      End Sub
      

      Using “Dim rs as Object” is real slow, even on a small test table. And was not necessary to convert combo value with STR function. This is obvious, but are you sure the form’s recordsource includes the MemberID field?

    • in reply to: Get rid of Highlighted Data in field (2000) #571839

      I checked out the attachment, if you changed the Enabled/Locked properties from Yes/No to No/Yes the highlighting went away… but if you want to change the Keyboard “Behavior Entering Field” options when opening/closing form use the applicable Application SetOption method on the form’s On Open or On Close event:

          Application.SetOption "Behavior Entering Field", 0 'Select entire field
          Application.SetOption "Behavior Entering Field", 1 'Go to start of field
          Application.SetOption "Behavior Entering Field", 2 'Go to end of field
       

      HTH

    • in reply to: Get rid of Highlighted Data in field (2000) #571695

      If text will not be updated then change the text box Tab Stop property to No and text will not be highlighted when you open form.

    • in reply to: Error: MS Jet Engine stopped (MS Access 97) #571424

      According to a Microsoft Knowledge Base article, the error message you are getting may be due to a corrupted memo or OLE field. You may want to check out this article: ACC: Jet Database Engine 3.x Error Messages Due to Corruption (Q182867)

      HTH

    • in reply to: FoxPro ODBC Import (Access 2000) #571328

      In what version of FoxPro are these tables? If they are old FoxPro 2.X tables you should be able to use the Free Table Directory option under “Database type” when setting up the ODBC Data Source using the Visual FoxPro driver. If the tables are created in Visual FoxPro 3.0 or later, then Free Table Directory doesn’t work, you have to select the “Visual FoxPro database (.DBC)” option when setting up the data source. You would then browse for the path of the *.DBC file, which acts as a container for the Visual FoxPro tables (*.DBF files) (they would be in same folder). If set up correctly you should then be able to either link or import the Visual FoxPro tables.

    • in reply to: Character Converstion (2000) #570760

      If using StrConv function in a query expression, use the vbProperCase constant’s numerical value rather than named constant, e.g.:

      StrConv([FLD_NAME],3) 

      The Object Browser will provide the numerical equivalent for named constants, e.g. Const vbProperCase = 3.
      HTH

    • in reply to: Filter in Reports (Access 2000) #569401

      You could use something like this:

      Private Sub Report_Open(Cancel As Integer)
      
          Me.Filter = "[CustomerID] In (1,7,17,52,53)"
          Me.FilterOn = True
      
      End Sub
       

      This assumes the CustomerID number is an actual number and not text. If CustomerID is text data type then the filter values should be delimited by single quotes:

      "[CustomerID] In ('1','7','17','52','53')" 

      In either case the “Me.Filter” should precede the “Me.FilterOn” statement. If the values you are filtering on can change in number or value, recommend using an array variable to populate the “IN” statement.
      HTH

    • in reply to: Enumerating Queries (Access 2000) #568444

      Not sure what you want to look for, but you can search each query’s SQL for a specified string using something like this:

       Sub SearchQuerySQL(strFindMe As String)
      
          Dim db As DAO.Database
          Dim qry As DAO.QueryDef
          Set db = CurrentDb
          
          For Each qry In db.QueryDefs
              If InStr(qry.SQL, strFindMe) > 0 Then
                  Debug.Print "QUERY: " & qry.Name & vbCrLf & "SQL: " & qry.SQL
              End If
          Next qry
          
          Set db = Nothing
          Set qry = Nothing
      
      End Sub
      

      This will print both name of query and its SQL string where match is found. If you only need to identify the query, modify the Debug.Print statement accordingly.

    • in reply to: Filter on Memo Field Contains Searchstring (Access 97(SR-1)) #567372

      If you use a parameter query the SQL would look like this:

      SELECT TBLNAME.COMMENTS
      FROM TBLNAME
      WHERE (((TBLNAME.COMMENTS) Like "*" & [ENTER SEARCH STRING:] & "*"));

      HTH

    • in reply to: Time Field (Access 2000/2002) #565752

      If you are trying to sort report by time only (disregarding date information) you might try using the TimeValue function in your report or underlying query to convert Date/Time field value to a time-only value. For example, if you have a Date/Time field named “DATE_UPDTD”, use this expression in a query:

      TIME_UPDTD: TimeValue([DATE_UPDTD])

      Then sort on the TIME_UPDTD column to sort records from earliest time to latest, ignoring the date values. Note in this example if the date/time field is null, the expression will generate an error, so you would have to either filter out the null date/time records if there are any, or modify the expression.

    • in reply to: Color of tab control (2000) #565368

      No, you’re stuck with default grey. Your only option would be to set tab control’s Back Style property to Transparent and then the section back color would be displayed beneath any controls placed on the tab control. The tabs themselves (or buttons) would still be generic grey, however. Other option is to add a rectangle on a tab control page, set back style to normal and set back color to desired color. You may have to use Format > Send to Back command to make sure the rectangle doesn’t obscure any controls inside its borders. Combined with first option you may achieve desired effect.

    • Select the rectangle then use Format menu > Send to Back command to send rectangle “behind” the controls. Or make rectangle transparent then select the controls and use Format > Bring to Front command.

    • in reply to: music accompany file (EXCEL 2000) #564951

      Another option is use Insert Object > Create from File command to insert the .MP3 file on a worksheet as an object. Use something like this to playback the sound:

      Sub PlayAudio()
          Application.DisplayAlerts = False
          Worksheets(1).Shapes("Object 1").Select
          Selection.Verb
          Application.DisplayAlerts = True
      End Sub

      You can call this sub from the Workbook_Open event to have music play upon opening workbook. As recommended by Andrew C. make sure your MP3 player is active but minimized or else it will pop up on top of your workbook (I tested this with MusicMatch Jukebox player). One possible drawback if the MP3 file is linked, when you open the workbook you get the dreaded “The workbook you opened contains automatic links to another workbook…” alert. If the MP3 file is embedded you won’t have this problem, but for a 5 minute MP3 you will have a very large .XLS file.
      HTH.

    • in reply to: Close All Open Forms (Access 2000 /2002) #564918

      WSC:

      I was unable to reproduce loop error on my system. I’m running A2K SR-1A on WIN 98 SE. I did find one bug, though, in the database I was testing this with I have form that allows user to open more than one instance of same form. There are other forms that requery certain controls on the first form on their On_Close event. If I had several instances of first form open and one or more of these other forms open, it sometimes resulted in runtime error 2450, depending on sequence in which the forms were opened (IsLoaded equated to true, but name of form not found in Forms collection). I added error handling for this. If you are not opening multiple instances of same form this should not be an issue.

    • in reply to: Close All Open Forms (Access 2000 /2002) #564910

      You can use the following code to close all open forms in your application:

      Public Sub CloseOpenForms()
      
          Dim frm As Form
          Dim n As Integer
          n = Application.Forms.Count
          
          Do While n > 0
              For Each frm In Application.Forms
                  If IsLoaded(frm.NAME) Then
                      DoCmd.Close acForm, frm.NAME
                  End If
              Next frm
              n = Application.Forms.Count
          Loop
      
          Set frm = Nothing
          
      End Sub

      You need the Do Loop to refresh open forms count or else not all forms will be closed. The above uses the IsLoaded function found in Northwind.mdb:

      Function IsLoaded(ByVal strFormName As String) As Boolean
      ' Returns True if the specified form is open in Form view or Datasheet view.
          
          Const conObjStateClosed = 0
          Const conDesignView = 0
          
          If SysCmd(acSysCmdGetObjectState, acForm, strFormName)  conObjStateClosed Then
              If Forms(strFormName).CurrentView  conDesignView Then
                  IsLoaded = True
              End If
          End If
          
      End Function 

      These two procedures should be added to a standard module. To close all forms (including the one you are calling the procedure from) and open a new form, use this code for a event procedure:

      CloseOpenForms
      DoCmd.OpenForm "NameOfNewForm"

      Hope this helps.

    Viewing 15 replies - 1,861 through 1,875 (of 1,889 total)