Results 1 to 4 of 4
  1. #1
    manglao is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    2

    Updating certain fields, deleting others. Please help =]

    Hey guys, I am posting here cause I have an access related problem that I have no idea about fixing, google didnt help much so I figured you guys might know.

    I am a university student doing an access project for one of my modules. I wont go into much detail about the project but basically we are making a library management system and we arent sure how to handle a particular problem.

    We have also been told that we arent aloud to use VB at all.

    I dont want to ask for to much information (Cause this needs to be original work, no plagiarism). Basically we need a button on a form which deletes certain fields on the form from one table and then adds a whole new record to another table using data on the form.

    So basically I have 3 questions:
    How theoratically could we achieve this? (Macros, Queries, Both)
    What are the relevant macro or query statements we would need?

    Side question: Is is possible to easily change the button styles in access 2007

    Any help would be much appreciated, but please no VB. =]
    Thanks in advance for any replies.
    Access 2007

    -Manglao

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Well, to start, having a button on the form will mean running vba coding behind that button (whether it calls a macro to open a query or it just opens a query (which is easier)).

    I would design a query which has a field in it for the autonumber/unique field (such as PersonID) with criteria such as: =Forms!MyFormName!PersonID. You can then set this up as an update query to remove certain values (ie.update those fields with Null). You could change (and save as another name) this type of query to an append query to append the data to another table.

    Or you can again use another query (creating expressions) to grab data from the form and use that in append type query to append data from the form to a specific table. For example, one of your expressions might be: FirstNameExp: Forms!MyFormName!FirstName (and this field appends to field FName in the query to append to table XYZ.)

    Ideally, you'd use the docmd.openquery "MyQueryName" command (if ADO) in vba to execute these in the OnClick event of the button. You can use DAO coding type as well.

    ie. (in ADO)

    Private sub OnClick_MyButtonName()
    docmd.setwarnings false
    docmd.openquery "MyQuerytoUpdate"
    docmd.openquery "MyQuerytoAppendtoNewTable"
    etc....
    docmd.setwarnings true
    end sub

  3. #3
    manglao is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    2
    thanks for your help. We appear to have solved the problem

  4. #4
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Quote Originally Posted by manglao View Post
    thanks for your help. We appear to have solved the problem

    Could you post what your solution was?

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

Similar Threads

  1. Updating Autonumber Fields
    By Rawb in forum Code Repository
    Replies: 4
    Last Post: 02-21-2011, 07:17 AM
  2. Replies: 11
    Last Post: 12-14-2010, 01:25 PM
  3. Replies: 1
    Last Post: 11-05-2010, 04:51 AM
  4. Error in updating fields
    By Kookai in forum Access
    Replies: 1
    Last Post: 08-01-2010, 12:07 AM
  5. Auto-updating fields in linked tables?
    By Leelers in forum Database Design
    Replies: 27
    Last Post: 01-08-2010, 06:23 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