Results 1 to 6 of 6
  1. #1
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    Update date

    Hello,


    I am new in Access so help will be graetly appreciated. I have failry large Access database on my job which consists two large tables- CapOneRemit and CapOneWireShedule. The table are populated from Excel via macros.Sometimes, I need to update dates (the filed is-"remitdate" teh same in both tables) and to do so I have created two update queries-CapOneDateUpdate and CaponeWiredateupdtae to update f.e 09/16/2001 t 09/15/2011 .I would like to create a form(frmupdatesupdate) with two text boxes on it and with command button .So , if I would like to update dates I type in form update date and criteria and by cliking command buton make update. Can I link text boxes on the form to updates oueries via vb code.
    Thank youi for help.
    Best Reagrds,

    Boris

  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 don't need VBA code; this should work:

    UPDATE CapOneRemit
    SET remitdate = Forms!FormName.TextboxName
    WHERE remitdate = Forms!FormName.AnotherTextbox
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    Update Date

    Thank vey much pbaldy!!!

    Just one small questins -I need to type this
    "UPDATE CapOneRemit
    SET remitdate = Forms!FormName.TextboxName
    WHERE remitdate = Forms!FormName.AnotherTextbox "
    in the command button even click ?
    Thank you in advance,
    Best Reagrds,

    bORISgomel

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No, that's a query. You can execute it from code, but not directly in the property like that. First you'd get into the VBA editor for that event:

    http://www.baldyweb.com/FirstVBA.htm

    The code would look like:
    Code:
      Dim strSQL                  As String
    
      strSQL = "UPDATE CapOneRemit " _
             & "SET remitdate = #" & Forms!FormName.TextboxName & "# " _
             & "WHERE remitdate = #" & Forms!FormName.AnotherTextbox & "#"
    
      CurrentDb.Execute strSQL
    Correcting all the names of course.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    Update dates

    Thank you very much pbaldy,

    I did as you showed me and it is working nicely .

    Thank you again,

    the Best regards,

    BorisGomel

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. query to update a date based on another date
    By tkendell in forum Access
    Replies: 3
    Last Post: 06-29-2011, 09:32 PM
  2. date selection update query
    By mountainwombat in forum Queries
    Replies: 2
    Last Post: 06-07-2011, 09:29 PM
  3. Trying to Automatically update date within form
    By accesskid in forum Programming
    Replies: 4
    Last Post: 04-26-2011, 07:45 AM
  4. Replies: 2
    Last Post: 10-11-2010, 09:09 AM
  5. Extra date field update
    By georgft in forum Forms
    Replies: 0
    Last Post: 09-17-2008, 06:51 AM

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