Eoin H
Eoin H

Reputation: 311

MS Access - Add new record using form and add info to subform

Not exactly sure how to title this one..

I have 2 tables (websites & website_info).

The websites table has a column called websites_website_info_id, which has a relationship linked to the website_info_id row in the website_info table.

I created a form from the websites table, and I want to be able to choose a row from the website_info table (in a subform). For example, the website_info table has a list of hosting providers used, I need to link these hosting providers with the websites. Only problem is, I cant find a way to choose a singe row from the website_info table and insert the id number into the websites_website_info_id column of the websites table.

I can create a lookup to find the ID, but i have to copy and paste it, which is not ideal because there will be others using this app. If it was just me, then i would be ok with that, but I need it to be as easy to use as possible for anyone to use without having to give too much instruction.

So, is there a way to find a value in a subform and add a value from the subform to a column in the main form.

Normally I would just use a lookup on the column in the table itself, but the database is a myslq database hosting on an external server so using lookups isn't an option.

Upvotes: 0

Views: 59

Answers (1)

Gustav
Gustav

Reputation: 56016

Yes.

This will - in the main form - return the current ID of the subform:

Dim SubId As Long
SubId = Me!NameOfYourSubformControl.Form!ID.Value

Upvotes: 1

Related Questions