• WSlesoch

    WSlesoch

    @wslesoch

    Viewing 15 replies - 31 through 45 (of 98 total)
    Author
    Replies
    • in reply to: Corrupted A2K mde file (A2K SP3) #668875

      Thanks, Hans, I do have the mdb version of the mde file, and it is the front-end with mostly codes. No important data is lost. I just wonder if all the solutions provided at the Microsoft web site and other sites to prevent occurrence of “Unrecognized database format” error applicalbe to a mde file, as the information I got invariably mentioned only mdb files.

    • After checking out the resources in the Internet, I managed to come out with these codes which could be compiled and run under A2K without error and managed to disable the AskAQuestionDropdown in Access XP:

      Sub CheckAskAQuestionDropdown()

      Dim obj As Object

      Set obj = Application

      On Error Resume Next
      obj.CommandBars.DisableAskAQuestionDropdown = True

      End Sub

      How and why
      obj.CommandBars.DisableAskAQuestionDropdown = True
      wasn’t flagged an error when compiled under A2K I wasn’t really clear though.

      But as happened before, my “clever” codes would turned out flawed.

      Hans, do you foresee any caveat in the codes above?

    • You are right, Mark, it was the reference problem. Thanks for your help.

      Regards,
      Lesoch

    • Thanks, Hans, it works. But my next problem is : How would I incorporate
      CommandBars.DisableAskAQuestionDropdown = True
      into my Accesss 2000 codes? I don’t want to keep two versions of the codes just to disable the help dropdown list in Access XP!

      I can detect the presence of A2K or Access XP and have a boolean varible AccessXPDectected. These are my codes:

      If AccessXPDetected then
      CommandBars.DisableAskAQuestionDropdown = True
      end if

      But CommandBars.DisableAskAQuestionDropdown = True is always flagged as error since DisableAskAQuestionDropdown property isn’t avialble in A2K’s CommandBars. Is there a way to get around this?

      Regards,
      Lesoch.

    • in reply to: OK in Offcie 2000 & Office XP but not OK in Office (A2K) #665368

      I will check the reference after this. Thanks. Just puzzled that why no error was falgged for clicking button A but error for clicking button B, while the two On Mouse Move action property refer to the same global function.

      Regards,
      Lesoch.

    • in reply to: OK in Offcie 2000 & Office XP but not OK in Office (A2K) #665366

      Hans, can I use VBA to programmatically make the “Type a question for help” box disappear?

      Regardas,
      Lesoch

    • in reply to: Can we change the LCID in VBA? (A2K SP3) #664067

      Hans, I checked the values at the registry location you suggested. In my system, there were quite a number of LCID entries, with all ‘Off’ except 1033 which was shown as ‘On’. 1033 is my setting: US English. Then I just executed the CJK-Input program, and checked the registry again. In addition to 1033 which was still stated as ‘On’, I had another LCID 2052 which was marked as ‘On’. But my Regional Settings were already changed, and so was my shortdate format. Exiting from the CJK-Entry program didn’t turn the registry entry of 2052 to ‘Off’, as was expected.

      When I ran my Access application with the CJK-Entry program in memory, and access the system LCID from VBA, the default system LCID was 2052. I tried to change the value to, say 1033, and set the LCID. I failed to reset the LCID. Maybe we are allowed to change the LCID values in VBA.

      Here are the codes I use (the codes aren’t original, but modified from codes that I obtained from Internet sites. Sorry I can’t remember the name of the sites where these codes were extracted and gave them credits):

      ‘ Regional Date Settings in VBA
      Public Declare Function GetSystemDefaultLCID Lib “Kernel32” () As Long
      Public Declare Function GetUserDefaultLCID Lib “Kernel32” () As Long

      Public Declare Function GetLocaleInfo Lib “Kernel32” _
      Alias “GetLocaleInfoA” _
      (ByVal locale As Long, _
      ByVal LCTYPE As Long, _
      ByVal lpLCData As String, _
      ByVal cchData As Long) As Long

      Public Declare Function SetLocaleInfo Lib “Kernel32” _
      Alias “SetLocaleInfoA” _
      (ByVal locale As Long, _
      ByVal LCTYPE As Long, _
      ByVal lpLCData As String) As Long

      Public Declare Function PostMessage Lib “user32” _
      Alias “PostMessageA” _
      (ByVal hwnd As Long, _
      ByVal wMsg As Long, _
      ByVal wParam As Long, _
      lParam As Any) As Long

      Public Const LOCALE_SENGLANGUAGE As Long = &H1001 ‘ English name of localized language
      Public Const LOCALE_SSHORTDATE = &H1F ‘ short date format string
      Public Const LOCALE_ICALENDARTYPE = &H1009 ‘ Set calendar type to Western
      Public Const HWND_BROADCAST As Long = &HFFFF&
      Public Const WM_SETTINGCHANGE As Long = &H1A

      Private Const strShortDateBaru = “dd/MM/yyyy”
      Private strShortDateAsal As String

      Public Function GetUserLocaleInfo(ByVal dwLocaleID As Long, _
      ByVal dwLCType As Long) As String

      Dim strReturn As String
      Dim lngRet As Long

      ‘ Call the function passing the Locale type variable to retrieve
      ‘ the required size of the string buffer needed
      lngRet = GetLocaleInfo(dwLocaleID, dwLCType, strReturn, Len(strReturn))

      ‘ if successful (lngRet > 0)
      If lngRet Then
      strReturn = Space$(lngRet) ‘ pad the buffer with spaces
      ‘ and call again passing the buffer
      lngRet = GetLocaleInfo(dwLocaleID, dwLCType, strReturn, Len(strReturn))
      ‘ if successful (lngRet > 0)
      If lngRet Then
      ‘ lngRet holds the size of the string including the terminating null
      GetUserLocaleInfo = Left$(strReturn, lngRet – 1)
      End If
      End If

      End Function

      ‘ Set short date format of system
      Function SetShortDateFormat() As String

      Dim LCID As Long ‘ Locale ID
      Dim strDateFormat As String
      Dim strLocale As String

      ‘ LCID = GetUserDefaultLCID()
      LCID = GetSystemDefaultLCID()
      ‘ Get user’s original short date string
      strShortDateAsal = GetUserLocaleInfo(LCID, LOCALE_SSHORTDATE)
      ‘ Set the new short date format
      Call SetLocaleInfo(LCID, LOCALE_SSHORTDATE, strShortDateBaru)
      If LCID = 2052 Then
      strLocale = “1033” ‘ LCID=”1033″ => English US
      Call SetLocaleInfo(LCID, LOCALE_SSHORTDATE, strShortDateBaru)
      End If
      ‘ To make the change take place through the system immediately
      Call PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0&, ByVal 0&)

      End Function

      ‘ Reset short date format of system back to original
      Function ResetShortDateFormat() As String

      Dim LCID As Long

      LCID = GetSystemDefaultLCID()
      ‘ Reset the original short date format
      Call SetLocaleInfo(LCID, LOCALE_SSHORTDATE, strShortDateAsal)
      ‘ To make the change take place through the system immediately
      Call PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0&, ByVal 0&)

      End Function

      Note: Calendar type isn’t available for LCID 2052.

    • in reply to: Can we change the LCID in VBA? (A2K SP3) #663865

      Actually I didn’t explain the reason why I wanted, if possible, to change the LCID of the system. The CJK-Input program that I ran together with my Access application unceremoniously changed the LCID of my system setting from 1033 to 1028 or 2052, depending on the setup of the CJK-Input program. I used short date format for date entry and the local “official” format is dd-MM-yyyy, and it was set in my Access application. However, the short date format dd-MM-yyyy isn’t available under LCID 1028 or 2052, and there is no way I can twist the short date entry format without changing the LCID value. The short date format used by the program was M-d-yyyy (the other format variations all with month appearing first). Furthermore, after using and exiting from the CJK-Input program, I need to manually reset my regional short date setting to dd-MM-yyyy.

      If I can set the LCID value back to 1033, I guess I can set the short date format to dd-MM-yyyy too while leaving the CJK-Input function unaffected.

      I will sure give Hans’s suggestion a try.

    • in reply to: How to send Ctrl keystroke only? (A2K SP3) #663618

      Hans, I inserted the DoEvents just before End Sub in my 386 WinMe machine, the codes worked magically. On my Pentium 4 WinXP machine, the codes didn’t work.

      Based on Pat’s suggestion, I added the loop below:

      Dim i As Integer
      For i = 1 To 1000 ‘ Set up counting loop (the loop can be reduced further)
      DoEvents
      Next i

      The codes also work in my WinXP machine now.

      My sincere thanks to Wendell, Hans and Pat for your help. But can someone explain to me why it appeared that timing was important in this case?

    • in reply to: How to send Ctrl keystroke only? (A2K SP3) #663416

      No, Hans, it doesn’t work when I inserted DoEvents in between the two keyboard events and/or just before End Sub. Sigh.

      Regards,
      Lesoch.

    • in reply to: How to send Ctrl keystroke only? (A2K SP3) #663367

      I surfed the Net and came out with these codes to simulate pressing and releasing of a Ctrl key :

      Private Const VK_CONTROL = &H11
      Private Const KEYEVENTF_KEYUP = &H2
      Private Const KEYEVENTF_EXTENDEDKEY = &H1

      Private Declare Sub keybd_event Lib “user32” _
      (ByVal bVk As Byte, _
      ByVal bScan As Byte, _
      ByVal dwFlags As Long, _
      ByVal dwExtraInfo As Long)

      ‘ Simulate pressing CTRL key
      Function ToggleEntry()
      ‘ Simulate Key Press
      keybd_event VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY Or 0, 0
      ‘Simulate Key Release
      keybd_event VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
      End Function

      Pressing the CTRL key once will activate the CJK-Input screen of my application which is already loaded into the computer memory, and pressing CTRL key a second time will de-activate it and Access will accept English input normally.

      The codes worked perfectly in debug mode when I stepped through the ToggleEntry() codes line by line. The CJK-Input screen of my application was activated and de-activated as expected. However, when I executed the codes normally, it didn’t work. Why?

    • in reply to: How to send Ctrl keystroke only? (A2K SP3) #663195

      No, it isn’t, Wendell. It is a Windows program now in its WinXP version. It is a CJK-input program in which pressing a Ctrl key would bring up the character-input screen and user can key in CJK characters for input in a bound control, say, and pressing Ctrl again would toggle it off. Is there any other method of sending a key besides Sendkeys?

    • in reply to: Exporting separator mask? (A2K, SP3) #662760

      Thanks Hans for reminding me some Access basis which I innocently ignored. I didn’t wait for the “future” but created a few lines of codes to add in the separator for all the same field in my database.

    • in reply to: List distinct field values (A2K SP3) #662758

      Thanks, Hans. This was the fourth time you helped me out. Your code template worked perfectly for my purpose. Thanks again.

    • in reply to: List distinct field values (A2K SP3) #662563

      Thanks for your response, Hans.

      What I want is to make the process automatic. Say I have classes named 2A, 2B, 2C, and 2D, which I may not know beforehand. I want by just supplying a class name “2”, and the program will get the distinct class names 2A, 2B, 2C and 2D, and then for each distinct class, save the info into files 2A.dbf, 2B.dbf, 2C.dbf and 2D.dbf.

      I am really dumb. I don’t see how the SQL statement “SELECT DISTINCT Class_Name FROM tblClass_Info” will help. Apparently I need to know the Class_Name, which I may not know, as I only know their names start with “2”. My post must have been unclear. Can you elaborate it a little, please?

    Viewing 15 replies - 31 through 45 (of 98 total)