Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Subforms to Add Table Records

Status
Not open for further replies.

jjlogan

Programmer
Joined
Jan 11, 2002
Messages
178
Location
US
I am developing an Access 2003 (SP2) project that has two tables (in particular) with a one-to-many relationship. The two tables are populated at the beginning of the year with downloaded data from Accounting's table of Job and Subjob codes on the corporate network; my application will use the tables to add additional fields for specific use. I have no problem downloading data into the tables, but I'm having trouble understanding the best way to add a single record to my main table and then one or more related records in the "many table" when we find we need to add or delete a particular record. Generally, my Access applications use forms to add a single record by navigating to the last record + 1 and just enter data for the appended record. However, I am now using main with subform to display the records and would like to click in the subform and go to the end of the data source and just type in the new data for new record; but this is not working and I get MS error 'The value you entered isn't valid for this field.' Are subforms suppose to be used for adding new records, or do I need to use separate ADO/DAO or DoCmd.Run Sql INSERT INTO techniques?
Thanks,
Jeff
 
How are ya jjlogan . . .

Is the subform linked with [blue]Master/Child link[/blue] properties?

For the subform have a look at the [blue]Data Entry[/blue] property . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Ace,
I am currently going the route of not using a subform embedded on a main form; instead, I am backing up a single form with query that joins the master table and "many" side table and then I am planning to validate all entries and basically control the data integrity in both tables. BUT, I really want to understand if main/subform structure can be used to add and delete record(s) to either table. An top flight Access Programming refence book does not even address this issue when covering form/subforms.
Your Questions: I used the Link Master Field and Link Child Field and assigned both to my field Job (primary key in main table and foreign key in "many" table. In the subform, the property Data Entry was set to No.

Thanks,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top