User Profile

Collapse

Profile Sidebar

Collapse
mhaledot
mhaledot
Last Activity: Oct 6 '11, 01:30 PM
Joined: Oct 4 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • mhaledot
    replied to syntax error, missing operator
    Not that it really matters (to the specific topic of this thread), but thanks to both you and NeoPa I have a code that searches for the record and yells at the user if they duplicate it (not literally of course - but that may one day be necessary) and takes them to the existing record if it does exist (that last part I actually figured out on my own - I can be taught!).

    Seriously, this will make the database that much more efficient....
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    @zepphead

    Thank you very much! I implemented the changes (as shown below) and now the code is functioning as I expect! And it has less "meat" which I always like.

    Code:
    Private Sub Save_Record_Click()
    
    'Establish a RecordSet of any Records which meet the search criteria.
    'Record count = 0 allows save
    
    Dim rs As DAO.Recordset
    Dim strSQL As String
    
    strSQL
    ...
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Thank you. It may, in fact, help a lot. I know it probably obvious by now, but I'm not really very familiar with VBA... I guess I'm "learning by accident" as my coworkers prove to need more locks than I ever thought my "simple" record keeper database would need.
    See more | Go to post
    Last edited by NeoPa; Oct 5 '11, 02:44 PM. Reason: Remove redundant quote

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    I know I posted it previously, but what I want to have happen is when a user enters a duplicate basicall "catch" the error (number 2950 apparently) and give the user the option to go to the the record they tried to duplicate or change their attempted entry to something not duplicated for appending to the table. If there is no duplication, then just save the entry in the table.

    Am I just going about this the entirely wrong...
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Removing the parenthensis does not appear to affect the outcome.


    That is, the If statement still answers as though true - even when I feed information which should be false.
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Thank you. Previously I got a pop-up with the error...

    Anyhow. It produced:
    [ReportType]= 'CR' AND [PI] = '0000409'

    and
    [ReportType]= 'Rev CR + L&D' AND [PI] = '1234567'

    and
    [ReportType]= 'ICTM' AND [PI] = '1234567'

    (I had tried a few times). I'm pretty sure this is what I want it to produce. I cannot tell if this is going through the FindFirst though (as I get...
    See more | Go to post
    Last edited by mhaledot; Oct 4 '11, 08:41 PM. Reason: Golly gee my spelling is horrid!

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    I feel really dumb now. I added that line, ran the form (clicked the button after entering some data), but it won't produce anything.

    Code:
    ...
    
        If (PI_Number & vbNullString) = vbNullString Then Exit Sub
        Dim rs1 As DAO.Recordset
        Set rs1 = Me.RecordsetClone
    Debug.Print "[ReportType]= '" & Report_Type & "' AND [PI] = '" & PI_Number & "'"
    ...
    See more | Go to post
    Last edited by mhaledot; Oct 4 '11, 08:29 PM. Reason: Adding more information for clarification

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    That fixed the "L" problem... I believe the FindFirst is still "broken" though as I am still getting message "Hello" when the if should be false (and therefore giving me "Sorry, a review for 0000409 CR already exists." - without quotes).

    I should probably repost the code so that it's not too jumbled...

    Code:
    Private Sub Save_Record_Click()
        If (PI_Number & vbNullString)
    ...
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    WOW... It's taking the text from my Report Type and saying the first letter (becuase the test type I'm using right now is L&D) and saying Does not recognize 'L' as a valid field name or expression. Yikes. I need it to raed the entire entry in the field as the text string...
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Thank you again! I will try this and see what I can break from there. :)

    However, the NoMatch condition is giving me true everytime. So I get "Hello" even when the if statement *should* be false. So if I correct the "add new" portion, I believe I'll be back at square one of adding a record which already exists... And that is also the opposite of what I'm trying to accomplish.

    So the new problem...
    See more | Go to post
    Last edited by mhaledot; Oct 4 '11, 07:53 PM. Reason: Did not complete my thought before hitting "post reply"

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Sorry to continuously "double post" (triple post?) but I just noticed it is not correctly going through the if Statment. Should I create a new topic for this?
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Thank you. I could not for the life of me figure out how to properly concatenate that - hence why I was (poorly) using the SQL.

    I am still getting my message box when I know rs1.NoMatch should be false. That is, say I have a report in the database that is entitled '0000000' (seven zeros, as text) and has a report type of 'CR'. When I type that into my form, I should not get the message box. But I do...

    When I switch...
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Could the error possibly be fixed by inserting "Select"? If so, I have *no idea* where to insert the word.
    See more | Go to post

    Leave a comment:


  • mhaledot
    replied to syntax error, missing operator
    Rabbit, thanks - I am new to VBA so I was still muddling through what that would come out as.

    zepphead80, Funny thing is that when I saved & closed my code, then closed the form, then reopened the form and clicked the button that's supposed to run this, it (sortof) worked. Gave the opposite response than I wanted...

    So I have this database with Project ID Numbers (PI_Number) and I want to allow users to use a form...
    See more | Go to post

    Leave a comment:


  • mhaledot
    started a topic syntax error, missing operator

    syntax error, missing operator

    I hope it is not bad form to join and immediately ask a question (especially one that appears to be common). I have looked at my code so long today, that I cannot figure out what MS Access/VBA wants. I am apparently missing an operator. Any help is greatly appreciated.


    The snippet flagged when I debug is:
    Code:
        rs1.FindFirst ("[ReportType]= & Report_Type" & _
            "FROM Report_Status"
    ...
    See more | Go to post
    Last edited by mhaledot; Oct 4 '11, 06:01 PM. Reason: spelling error.
No activity results to display
Show More
Working...