Page 4 of 5 FirstFirst 12345 LastLast
Results 46 to 60 of 62
  1. #46
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

    So you only need records where the RepairWelders field has a value, correct?

  2. #47
    evilleve is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Tehran
    Posts
    31
    just for repair welders yes, but in other fields no

    (did you see the sheet? there is a field with name "WELD NO"
    when a welder weld a joint , after that we check the weld is correct and dont have a defect (ndt) all of these have calculations . repairing is the last step)

  3. #48
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    We need to concentrate on one issue at a time.

  4. #49
    evilleve is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Tehran
    Posts
    31
    ok , now we know we cant separate columns to rows and if we separate columns in this way we will have many many columns ....

  5. #50
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Columns *can* be separated into rows if that is what you decide to do.

  6. #51
    evilleve is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Tehran
    Posts
    31
    if they be divided to rows i cant use them

  7. #52
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why not? You lost me there.

  8. #53
    evilleve is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Tehran
    Posts
    31
    thanks for replying me .
    because in this way the rows become x2 and so more
    we dont need just RepairWelder field and some fields have relations with RepairWelder
    so its not the solution

  9. #54
    evilleve is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Tehran
    Posts
    31
    i used this as a function :

    Public Function MySplit(REPAIRWELDERS As String, MyDelim As String, InOffset As Integer) As String
    Dim MyArray() As String
    MyDelim = "("
    InOffset = 1
    MyArray = Split(REPAIRWELDERS, MyDelim)
    MySplit = MyArray(InOffset)
    End Function

    it works until the records has a "(" , when the record is null or dont have"(" it says :

    Run-time error '9'
    subscript out of range

    whats the problem ?

  10. #55
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I did not put any error checking in the function. Let's start by properly using the Function. Show me how you invoke the function in your query. Maybe posting the SQL view of the query will be enough.

  11. #56
    evilleve is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Tehran
    Posts
    31
    s: mysplit([REPAIR WELDERS];"(";1))

  12. #57
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So you are completing a field in your query named "s" correct. I'm not sure if a semi-colon works as a parameter separator. I use a comma:
    s: mysplit([REPAIR WELDERS], "(", 1)
    ...and we'll add some error checking to the Function in a bit.

  13. #58
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    And here's a new function to use that has some error checking built in:
    Code:
    Public Function MySplit(InString As String, Delim As String, InOffset As Integer) As String
       '-- Invoked this function by passing in:
       '-- InString - The string to separate
       '-- Delim - The separating delimiter
       '-- InOffset - The nth value in the InString to return
       Dim MyArray() As String
       If (Len(InString & "") > 0) And (Len(Delim & "") > 0) And (InOffset > 0) Then
          '-- There are values to work with, go ahead and separate the string
          MyArray = Split(InString, MyDelim)
          If LBound(MyArray) = 0 Then
             '-- Adjust the requested parameter for zero base request
             InOffset = InOffset - 1
          End If
          If InOffset > UBound(MyArray) Then
             MsgBox "Requesting offset above available values", vbCritical + vbOKOnly
             MySplit = ""   '-- Return a Zero Length String (ZLS)
          Else
             '-- Return the value requested
             MySplit = MyArray(InOffset)
          End If
       Else
          MsgBox "Incomplete arguments to MySplit Function", vbCritical + vbOKOnly
          MySplit = ""   '-- Return a Zero Length String (ZLS)
       End If
    End Function

  14. #59
    evilleve is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Tehran
    Posts
    31
    thanks .

    i put this as function :
    Public Function MySplit(REPAIRWELDERS As String, Delim As String, InOffset As Integer) As String

    Dim MyArray() As String

    If (Len(REPAIRWELDERS & "") > 0) And (Len(Delim & "") > 0) And (InOffset > 0) Then
    MyArray = Split(REPAIRWELDERS, MyDelim)
    If LBound(MyArray) = 0 Then
    InOffset = InOffset - 1
    End If
    If InOffset > UBound(MyArray) Then
    MsgBox "Requesting offset above available values", vbCritical + vbOKOnly
    MySplit = ""
    Else
    MySplit = MyArray(InOffset)
    End If
    Else
    MsgBox "Incomplete arguments to MySplit Function", vbCritical + vbOKOnly
    MySplit = ""
    End If
    End Function
    and this in query :
    s: mysplit([REPAIR WELDERS];"(";1)
    but when i run the query , in blank values an error happens :


  15. #60
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you tried single stepping the code to see what is happening? Put a breakpoint at the 1st If (just click outside of the margin and a DOT will appear) and F8 through the code and see what is happening.

Page 4 of 5 FirstFirst 12345 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Separate combo box
    By sanos_a in forum Access
    Replies: 1
    Last Post: 10-07-2010, 05:30 AM
  2. How To Chane Color Of Text In Columns
    By aamer in forum Access
    Replies: 5
    Last Post: 09-12-2010, 09:30 AM
  3. Run 2 Processes in Separate Threads
    By matt_tapia in forum Programming
    Replies: 1
    Last Post: 08-06-2009, 12:33 PM
  4. Separate queries?
    By sid in forum Queries
    Replies: 0
    Last Post: 08-01-2009, 10:31 AM
  5. Separate one field into many
    By ellen in forum Programming
    Replies: 5
    Last Post: 12-22-2008, 06:01 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