Results 1 to 7 of 7
  1. #1
    dhaneshjs is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    7

    Question Unable to fix a missing operator error

    Hi Friends,

    i have a Form which uses unbound textbox to display values from a table.
    Since it is textbox it will not be retain its value once i close access
    in order to view what i last entered i am trying to copy the values to another table
    and then on opening access again textboxes will be populated values from this table.

    But i am finding a problem while executing update command on closing

    DoCmd.RunSQL "UPDATE Table2 " & _
    "SET Table2.ID = " & ref & " " & _
    "SET Table2.Date = #" & date1 & "# " & _
    "SET Table2.Time = #" & time1 & "# " & _
    "SET Table2.VisitorName = '" & visitorname & "' " & _
    "SET Table2.POBRFC = '" & pobrfc & "' " & _
    "SET Table2.VisitorFrom = '" & visitorfrom & "' " & _
    "SET Table2.PR = '" & pr & "' " & _
    "SET Table2.RepeatNew = '" & repeatnew & "' " & _
    "SET Table2.Status = '" & status & "' " & _
    "WHERE Table2.Slno = " & slno & ";"


    This statement is returning an error
    as

    Runtime error '3075'

    Syntax error (missing operator)

    i am unable to identify the syntax error how much i tried

    Please Help me on this



    Thanks in advance
    Dhanesh

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    You do NOT use a SET for each column to be updated. Only 1 SET is used.

    see http://www.w3schools.com/sql/sql_update.asp

  3. #3
    dhaneshjs is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    7

    it worked

    Hi Orange,

    It worked. Thanks a lot
    Now i have a small problem

    How to enter blankspace to a field in a table
    which is having data type as 'Number'

    My issue is i am
    taking values from a text box
    to a variable of 'INTEGER' data type

    This variable is then used to update a tablefield with 'NUMBER' data type

    Dim ref as Integer
    Dim intK as Integer

    .
    .

    If (IsNull(Me("Text" & intK))) Or Me("Text" & intK).Value = "" Then
    ref = ""
    Else
    ref = Me("Text" & intK).Value
    intK = intK + 1

    After this i am updating a table
    using DoCmd.RunSQL

    While executing
    data mis match error is coming on line marked red

    Please help me on this

    Thanks in advance
    Dhaneshjs

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Why are you putting a sting in a number field? Do you want a 0?
    Please describe why?

  5. #5
    dhaneshjs is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    7

    enter blankspace

    Hi Orange,

    I don't want 0 appearing in the table field
    why i am asking is that i have
    a group of text boxes, at times some of these text boxes
    will have nothing in it.
    i am updating the values in all textboxes to the table at the time of closing the form
    so some textboxes may have certain values, some carry null also
    i am passing these values to a table and which ever textboxes have null value
    i want it to be converted to blankspaces in the table field
    so even if its a number data type field , i want blank spaces to come in
    the table.
    This is in order to avoid a error message popping up like " null value detected"

    Please help on this

    Thanks in advance,
    Dhaneshjs

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Have you seen the NZ() function? You could display 0, or something else, if the field is null.

  7. #7
    dhaneshjs is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    7
    Hi Orange,

    Could you also be helpfull
    in suggesting a way out for what i am planning
    As i have posted earlier
    i have several unbound text boxes as matrix(9 columns and 15 rows) in
    the form
    i am populating values to these textboxes from bound text boxes(to a table)
    that works as a place to input values.
    unbound text boxes gets value from the input bound textboxes and
    this unbound textbox matrix is for "displaying purpose".
    some of the text boxes are
    1. Status (IN/QUE/REVISIT)
    2. DATE
    3. TIME

    I actually wanted to sort the matrix display as
    status (ascending) then date (acsending) then time (ascending)

    i thought i could populate the unbound textboxes to an array,
    sort it as required
    and put it back on the unbound textboxes on the click of a button.

    i am finding it difficult to sort things like that using vba

    is there a better way of doing it?
    may be copying it to another table and then sort it and postback on unbound textboxes.

    Please give your advice on this.

    Thanks in advance
    Dhaneshjs

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Syntax error missing operator(3075)
    By parisienne in forum Programming
    Replies: 1
    Last Post: 04-07-2011, 02:29 PM
  2. Syntax Error...missing operator
    By jgelpi16 in forum Programming
    Replies: 14
    Last Post: 09-09-2010, 11:35 AM
  3. Error 3075 Missing Operator
    By KLynch0803 in forum Queries
    Replies: 5
    Last Post: 02-11-2010, 01:13 PM
  4. Replies: 1
    Last Post: 10-07-2009, 07:36 AM
  5. Missing Operator error
    By data123 in forum Forms
    Replies: 1
    Last Post: 03-15-2009, 04:34 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