Search Form Code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • f430
    New Member
    • Aug 2010
    • 43

    #46
    compiling the project was greyed out, but that was just because i was into the search section, and not the whole code. i was able to get it to work.
    please let me know if you still need me to attach the file based on my last response.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32634

      #47
      Originally posted by f430
      f430:
      please let me know if you still need me to attach the file based on my last response.
      I assume you are now reading my latest post. I think you've solved the main confusion, but I'm awaiting your response to know if we're still working together on this.

      Comment

      • f430
        New Member
        • Aug 2010
        • 43

        #48
        i wasn't trying to not use what i learned, i just had this sql before i fixed my code, and i was not sure if this query should have the same format as the code i used.
        should i have if statements like in post# 32 line#15??

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32634

          #49
          Basically yes.

          That is to say the query should be unfiltered, and the filter applied as it seems to be in post #32. Frankly I can only guarantee it should be like post #20, probably including any subsequent fixes if errors were found (it was all a long time ago now), but if you feel confident your changed code does the same job, then go with that if you prefer.

          You should understand that when a filter is applied retrospectively (as we plan to do here from the code in the form), then the item being filtered should fundamentally include all that we may be interested in looking at. If it is already filtered then it is likely that aplying a second, separate filter, will leave nothing displayed.

          Comment

          • f430
            New Member
            • Aug 2010
            • 43

            #50
            so this is gonna be a copy of the code, but instead of "if" we use "SELECT" or "procedure" , because it seems like it doesnt accept if or any quotation marks or at least not in the beginning of the code. it keeps saying that it is expecting "select", "update" , " insert" or "procedure"

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32634

              #51
              You are talking as if you don't know the difference between VBA code and SQL code.

              Earlier, we were talking about VBA code. We created a SQL filter string within this VBA to apply to the RecordSource of the form. The RecordSource would basically be a SQL string. The event procedures we've been working in though, would be VBA.

              Comment

              • f430
                New Member
                • Aug 2010
                • 43

                #52
                i have been trying to manipulate the vba code into my search query but im running into a lot of problems.
                i know that all i need to have are lines # 2, 6, 12, 17 from post #20
                but i cant seem to have the right sql for it.
                i was wondering if u had an example or anything that might help.

                Thanks

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32634

                  #53
                  I get the feeling you're not paying attention to what I post again. You keep coming back at me with stuff that makes no sense. I am trying to clarify things by asking important questions, designed to help me understand what you're talking about. If you ignore this and try to explain again in the same way as before we will get nowhere (Obviously. If I could understand you explaining it that way, there would be no need for the clever questions in the first place).

                  Either respond to my posts or I cannot help you. I can only help you to a certain extent to say what you need in a way that makes sense. If you ignore me then I can't help at all, and if I don't know what you're talking about I can't help technically either.

                  It's quite simple really.

                  Comment

                  • f430
                    New Member
                    • Aug 2010
                    • 43

                    #54
                    im not sure what questions i exactly missed, but i'll try to explain what i am having difficulty with.
                    for example if i take this code below:
                    Code:
                    If Not IsNull(Me.Defect) Then _
                           strFilter = strFilter & " AND " & "('" & Me.Defect & "' In([Defect Code 1]," & "[Defect Code 2]," & "[Defect Code 3]))"
                    how can i make this code in sql language?
                    i have been trying to put it in the "select, where" format, but it doesn't seem to be correct

                    Comment

                    • f430
                      New Member
                      • Aug 2010
                      • 43

                      #55
                      one more question, what is the purpose of having this search query when i have the vba code for my search form. would i be able to make my search form function without the query

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32634

                        #56
                        It seems to me you're still confused over the difference between SQL and VBA, but you ignored my post where I attempted to clarify this with you then simple carried on regardless.

                        Frankly, I find the first problem needs very careful handling, which is entirely impossible unless I have your full attention. Simply ignoring it and hoping it will go away is not going to make for good (any) progress. Trying to proceed from that point is unwise in the extreme. To illustrate, it's like finding someone to ask for help, and when you find they only speak Eskimo, going on to ask them to explain Einstein's Special Theory of Relativity. It matters nothing how important it is for you to understand it. You will not understand what they say anyway, and they have no idea what you're asking.

                        Comment

                        • Michael Adams
                          New Member
                          • Jul 2010
                          • 55

                          #57
                          F430, are you using the program Access by Microsoft or are you using SQL by Microsoft or perhaps you are in Visual Basic Studio or VB.net? Which one are you using, because the code is fundamentally different for each!
                          IE... Code for running a SQL Statement in SQL is different than running the same code in Access(VBA).

                          So, Which program are you using? (Is this a good question NeoPa?)

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32634

                            #58
                            Originally posted by Michael Adams
                            Michael Adams:
                            (Is this a good question NeoPa?)
                            It seems valid. Fundamentally, anything which can help communication is good. Communication in this thread is pretty poor overall. That is not to say anyone is being lazy or not trying, as some people just don't have good instincts or skills in that direction. Anything that can help members to understand the critical nature of clear communication, and how much depends on that, is a good thing in my book.

                            PS. From what's been posted already I'm fairly sure Access is the application involved. There seems to be some confusion over how SQL & VBA fit into the whole picture, but I'm confident that's where the issues lie.

                            Comment

                            • Michael Adams
                              New Member
                              • Jul 2010
                              • 55

                              #59
                              Just for a side note then, When he is coding a SQL statement does it need to start like?
                              Code:
                              ssql

                              Comment

                              • NeoPa
                                Recognized Expert Moderator MVP
                                • Oct 2006
                                • 32634

                                #60
                                No Michael (unless I misunderstand you completely, which is possible as I don't know where you're coming from with this).

                                SQL statements are usually resolved first as VBA strings, and are then passed to the SQL interpreter in one of a whole bundle of ways.

                                The most common form of SQL would be a simple SELECT statement of the form :
                                Code:
                                SELECT   [X]
                                       , [Y]
                                       , ...
                                FROM     [Table]
                                WHERE    ...
                                ORDER BY ...

                                Comment

                                Working...