MushroomKing
Registered User.
- Local time
- Today, 02:45
- Joined
- Jun 7, 2018
- Messages
- 100
Hi everyone. I have a somewhat "general" question.
I have multiple examples where i would apply this, but i would like to keep the answers general so others can learn this basic, but useful way of going about data.
When i have a form, with a certain record source, that certain source is the data i can manipulate or get.
In some cases i have "subforms" for example.
They have their own record source (probably), but sometimes i just want to access the data from a subform on my mainform. If that makes sense.
For example:
I want a button on my main form that sends an email, i will use an event procedure. So i make a sub where i put the fields in my vba code...containing data from the subform! How would i go about this?
I could use Dlookup for each individual piece of data, but that's alot of code.
Could i use a recordset in this case? Or how does that work?
Hope to learn to code more efficient
I have multiple examples where i would apply this, but i would like to keep the answers general so others can learn this basic, but useful way of going about data.
When i have a form, with a certain record source, that certain source is the data i can manipulate or get.
In some cases i have "subforms" for example.
They have their own record source (probably), but sometimes i just want to access the data from a subform on my mainform. If that makes sense.
For example:
I want a button on my main form that sends an email, i will use an event procedure. So i make a sub where i put the fields in my vba code...containing data from the subform! How would i go about this?
I could use Dlookup for each individual piece of data, but that's alot of code.
Could i use a recordset in this case? Or how does that work?
Hope to learn to code more efficient

Code:
Private Sub emailupdate_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM table2") 'not my recordsource, but i want data from this table, only for now...
MsgBox Me.somefield
End Sub
Last edited: