Search results

  1. ritchieroo

    changing text box value

    If you want any alteration to Box3 to stick permanently, the simplest thing you can do is check whether it is empty before filling it (only fill if empty). Alternatively you could try using the BeforeUpdate event.
  2. ritchieroo

    VB script - creating a desktop shortcut

    this works, i think Set Shell = CreateObject("wscript.shell") DesktopPath = Shell.SpecialFolders("Desktop") Set link = Shell.CreateShortCut(DesktopPath & "\Test Link.lnk") link.Arguments = " /user TestUser" link.Description = "New Test Link" link.Hotkey = "Ctrl+Alt+T" link.IconLocation = ""...
  3. ritchieroo

    SQL Statement - Requery

    No need to declare CurrentDB, try commenting out this line Dim CurrentDB As Database
  4. ritchieroo

    arranging 4 bytes into Long data type

    Just in case you don't like using API functions, here's a pure VB way of doing it (probably nowhere near as efficient)... Public Function toLong2(ByVal n1 As Byte, ByVal n2 As Byte, _ ByVal n3 As Byte, ByVal n4 As Byte) As Long toLong2 = Val("&H" & Right$("0" & Hex(n1), 2) _...
  5. ritchieroo

    arranging 4 bytes into Long data type

    Use an API function for best results... Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (Destination As Any, Source As Any, ByVal Length As Long) Public Function toLong(ByVal n1 As Byte, ByVal n2 As Byte, _ ByVal n3 As Byte, ByVal n4 As Byte) As Long Dim b(0 To...
  6. ritchieroo

    Speed up code

    Why do you have this For...Next loop in your code? It lloks as if you want it to loop through each record in TableTest, but it doesn't do that the way you have it written. Instead it does exactly the same thing over and over depending on how many rows you have in your table. I'm assuming that...
  7. ritchieroo

    Listing table names

    Do you know the structure of each external table in advance? Are you going to open one form that could potentially display many different tables, or will you have diffent forms for each table?
  8. ritchieroo

    Listing table names

    what do you mean by "details of the table"?
  9. ritchieroo

    Listing table names

    You can get table names from the MSysObjects system table (usually hidden), and use the following SQL syntax to access an external database. Private Sub Form_Load() Dim sSql as String sSql = "SELECT [Name] " & _ "FROM MSysObjects IN 'C:\someother.mdb' " & _ "WHERE Type=1 and...
  10. ritchieroo

    Listbox - Horizontal instead of Verticle Display

    You're right in saying that the ListView control is predominately used on the VB development platform, but it is just an ActiveX control like any other and you can use it in any VBA environment. In practice some of these ActiveX components don't interact well with Access's design environment...
  11. ritchieroo

    Listbox - Horizontal instead of Verticle Display

    The control that comes closest to the sort of thing you want is a ListView control. You'll need to have a licensed copy of the Microsoft ListView Control ActiveX component on your machine.
  12. ritchieroo

    # sign added to end of value

    TIP: If you need to do any maths with very large integers, use the Currency data type. Unlike double and single, currency is fixed-precision, so you can avoid floating-point errors. Range: -922,337,203,685,477.5808 to 992,337,203,685,477.5807
  13. ritchieroo

    Find first avilable time slot size

    I used DateDiff to calculate duration of Gaps as well. I was using DateAdd to add 1 minute onto my recorded EndTime, in order to generate the GapStartTime etc.
  14. ritchieroo

    Date & Time Fixed Width Export

    Roll your own Fixed-Width export With a little bit of coding you can break your reliance on Access's inbuilt functionality and regain full control over your exports. See example code attached
  15. ritchieroo

    Primary key

    Just to clarify your terminology, you can only have one primary key per table, although it can be composed of several columns. There is nothing wrong with this sort of arrangement, and it is quite common when recording histories, for example, if you wanted to record the number of units produced...
  16. ritchieroo

    Find first avilable time slot size

    Here's Query3 from the database presented a little more cleary, also with GapMins column added. SELECT a.WorkerID , a.WorkDate , DateAdd("n", 1, a.EndTime) AS GapStart , Nz(DateAdd("n", -1, min(c.StartTime)), b.LatestEndTime) AS GapEnd , DateDiff("n", DateAdd("n", 1...
  17. ritchieroo

    Find first avilable time slot size

    This may help
  18. ritchieroo

    Set option buttons background color

    If you put your option buttons within a frame then set the Frame's Value property... Private Sub Form_Load() Me.Frame0.Value = 0 End Sub If you have separate option buttons then set the value property for each individually... Private Sub Form_Load() Me.Option1.Value = 0...
  19. ritchieroo

    delete table

    How about this? If CurrentDb.OpenRecordset("SELECT 1 FROM MSysObjects WHERE Type=1 AND Flags=0 AND Name='Table1'").RecordCount = 1 Then CurrentDb.Execute "DROP TABLE Table1" End If
  20. ritchieroo

    Dob

    You need an Age function Public Function Age(ByVal BirthDate As Date, ByVal CheckDate As Date) As Long Dim lAgeGuess As Long 'DateDiff isn't accurate on its own, need to check against CheckDate lAgeGuess = DateDiff("yyyy", BirthDate, CheckDate) If DateAdd("yyyy", lAgeGuess, BirthDate) >...
Back
Top Bottom