Results 1 to 4 of 4
  1. #1
    jhillbrown is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2010
    Posts
    6

    Update Query Which Asks Question


    I have an update query which works just fine. It is replacing the contents of a field called Price Per Person with an amount I specify in Update To. Is it possible to incorporate this query in a macro and have the query ask me what the new price is that's suppose to replace the old price? Thanks!!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    You can refer to a form for user input or have the query prompt:

    UPDATE TableName SET FieldName = [Enter new amount]

  3. #3
    carlmdobbs is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2010
    Location
    Maryland
    Posts
    26
    Hello. A query prompt is probably the least professional way of getting the information from the user. It is inadequate because it doesn't do the following:
    1: Verify that the user put in correct, useable information
    a) right data aype
    b) correctly spelled
    c) put in anything at all
    2: Doesn't give the user a chance to cancel the operation mid-stream.

    There are two bettwer ways. One is create an imput box in code.
    dim x as variant
    x = inputbox("Give me the last name"
    There is an argument for a default value

    The user puts in some informaiton.
    Then verify.
    If isnull(x) then
    msgbox "Cancelled."
    exit sub
    End If
    If Isnumeric(x) then
    msgbox "You must enter a name, not a number."
    Exit sub
    End If

    You get the idea.

    The best way is to do what someone else already said. Make a pop-up form to ask the user to put in information using a drop-down box or list box that has a list of correct choces. Then refer to the field to obtain the value and assign it to a variable. Use code to qualify the answer, if needed or to see if anything was selected at all.
    A form is better than an input box, still, even if it has no list or combo boxes because the answer put into the form does not have to be from a list or combo box. It can be evaluated if it is put into a text box. The text box can be formatted for dates, phone numbers, etc. which insure the data is correctly entered.
    Please remember that MS Access wizards are for the uninitiated programmers, (power users). That is okay, but professionals have to worry about data integrity and keeping the program bullet proof. We have to anticipate everything that can go wrong because everything will go wrong. Query prompts don't fit the bill. So ignore the query prompts as a means of getting information. That is a rinky-dink method. Go for an input box if the answer to a question is genuinely unpredictable (like , "What is your favorite animal?" whch is imipractical to put into a list.)

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    very well answered it is exactly how to do it.

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

Similar Threads

  1. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 AM
  2. Update question
    By oakoen in forum Access
    Replies: 3
    Last Post: 08-28-2009, 07:21 AM
  3. update query question
    By blusk06 in forum Queries
    Replies: 3
    Last Post: 05-30-2008, 05:55 AM
  4. Update Query
    By GrnISSO in forum Queries
    Replies: 0
    Last Post: 06-15-2007, 05:41 PM
  5. Qry that asks for specific employee name
    By oxicottin in forum Queries
    Replies: 0
    Last Post: 02-05-2007, 08:50 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