Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 5th, 2004, 12:27 AM
Authorized User
 
Join Date: Apr 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default add same data in diff table / search

Hi, I'm new learner of VBA, much appreciate you guys can give a big hands.

I have four tables with a same field "ID", how can i input data in table A, then it can be automatically update in other table b, c, d

Moreover, I want to add a search (find) function in a form, what is the script/procedure to call the record.

Thanks in advance.

 
Old April 5th, 2004, 10:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by yylee
I have four tables with a same field "ID", how can i input data in table A, then it can be automatically update in other table b, c, d
Close all tables, forms, etc. and just have the dB open. Click the "Relationships" button (or choose TOOLS > RELATIONSHIPS from the menu). In there, place the four tables. Click "ID" from your main table and drag it to "ID" in each table. When you do each, you'll get a dialog box. Make sure "Reinforce Referential Integrity" and "Cascade Update Related Fields" are CHECKED. Click CREATE. Save and exit the Relationships window.

From now on, if you edit the main table, the others will autoupdate.

Quote:
quote:Moreover, I want to add a search (find) function in a form, what is the script/procedure to call the record.
Make sure your wizards are turned on and place a combobox or a control button on your form. Let the Wizard's prompts ask you what you want and follow its instructions.

Welcome to P2P! :D


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 8th, 2004, 10:58 PM
Authorized User
 
Join Date: Apr 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Greg ,it works.
Since the data is inputted in FORM view, I don't know why it can't be add or edit in FORM, the last record (=>*) is dimmed. How can i activate the button. Thanks in advance.

 
Old April 9th, 2004, 06:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by yylee
the last record (=>*) is dimmed. How can i activate the button.
In form design view, click the form and make sure that...

Allow Additions = Yes
Allow Deletions = Yes
Allow Edits = Yes


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 10th, 2004, 01:11 AM
Authorized User
 
Join Date: Apr 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

They are already set YES. Any other method?
BTW, what means of bound / unbound form?
Thanks a lot!


 
Old April 10th, 2004, 07:54 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is your form based on a query (some times you can not edit those) or maybe you set the forms record source with the query builder (same thing, at times). By the way, Access comes with a find function, clik on the binoculars, this is the most useful method for searching.

Try not to code what has already been coded.






Sal
 
Old April 11th, 2004, 10:07 PM
Authorized User
 
Join Date: Apr 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Sal
I changed the form based on tables, so that they can edit.

Further to my first enquiry, one field in table C & D is related. How can I set one more relationship that these fields can be updated automatically. Much appreicate for your expertise advice.

 
Old April 12th, 2004, 10:01 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can the form edit now?



Sal
 
Old April 13th, 2004, 02:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yylee -
To relate C & D, use the same method that Greg mentioned. Just drag the field from tableC to the field in tableD, and enforce integrity

Steven

I am a loud man with a very large hat. This means I am in charge





Similar Threads
Thread Thread Starter Forum Replies Last Post
error when trying to add data to table Vince_421 Access VBA 17 May 6th, 2007 01:29 PM
Search / Add data in a ComboBox Sudoku Pro VB Databases 1 May 4th, 2006 07:51 PM
Search / Add data in a ComboBox Sudoku Visual Basic 2005 Basics 0 March 30th, 2006 11:21 AM
How to search for text in a diff col in Excel chiefouko Excel VBA 3 September 29th, 2004 11:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.