Martynwheeler
Member
- Local time
- Today, 08:13
- Joined
- Jan 19, 2024
- Messages
- 82
Hi there,
I am new to access and am trying to create a question db for my students. I have most of the db working but I am wondering about some general concepts and trying to get the best approach.
When setting the data for a form at run time I can set
Me.RecordSource = some SQL
However, this approach means that I have to hard code the sql string into my event rather than using a saved query with the parameters passed to it (or maybe I just can't figure out how).
It works but for large joins the sql string is several lines long and difficult to debug/edit.
The other approach is to set the forms recordset directly.
Me.RecordSet = some recordset
The latter approach allows me to send parameters to a saved query via querydefs. This all works for a foem
If I try the same for a report it says that it is no longer supported.
So a few questions:
In general, what is the preferred approach, setting the recordset or recordsource?
Is it possible to set the recordsource using a saved query with parameters?
Do I have to hard code the sql with where clauses to the recordsource?
Hope that makes sense.
Thanks in advance
Martyn
Thanks
I am new to access and am trying to create a question db for my students. I have most of the db working but I am wondering about some general concepts and trying to get the best approach.
When setting the data for a form at run time I can set
Me.RecordSource = some SQL
However, this approach means that I have to hard code the sql string into my event rather than using a saved query with the parameters passed to it (or maybe I just can't figure out how).
It works but for large joins the sql string is several lines long and difficult to debug/edit.
The other approach is to set the forms recordset directly.
Me.RecordSet = some recordset
The latter approach allows me to send parameters to a saved query via querydefs. This all works for a foem
If I try the same for a report it says that it is no longer supported.
So a few questions:
In general, what is the preferred approach, setting the recordset or recordsource?
Is it possible to set the recordsource using a saved query with parameters?
Do I have to hard code the sql with where clauses to the recordsource?
Hope that makes sense.
Thanks in advance
Martyn
Thanks