473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Binding controls to recordset with join

Lyn
Hi,
I am opening a form in Continuous mode to list the records from a recordset
created in the calling form. The recordset object is declared as Public and
is set into the new form's Recordset property during the Open event.
According to the VBA Help file, setting the Recordset property may adjust
the RecordSource property accordingly.

If I set the RecordSource to blank in Design mode, it remains blank when the
form is opened even after the Recordset property is set. Worse, it results
in the form shrinking to display only one record at a time. You can scroll
the form to see the complete set of records, but only one at a time. This
was the subject of a recent posting -- no one was able to explain why this
was happening. However, I found that by populating RecordSource with the
name of the table used in the recordset, the full vertical length of the
form was restored and I was able to see all the records.

Since then, I have changed the query behind the recordset so that it now
contains a join of two tables -- the original table and a second table.
With RecordSource still set to the original table, I can display all the
columns in the recordset belonging to that table, but not those belonging to
the joined table.

The RecordSource property can only be set to a table, query or SQL
statement. I need to be able to set it to the recordset. I thought that
setting Recordset property might achieve that effectively (but apparently
not).

I have tried setting the controls displaying the joined table columns via
VBA in the Current event, but this sets the control in every row to the
value of the column in the first record only.

I hope that this makes sense so far. My question is: how can I display in
Continuous mode fields in a Public recordset resulting from a joined query
in another form? I will be happy if the solution is in the query's SQL, in
the form's properties or in VBA. Any help greatly appreciated.

--
Cheers,
Lyn.
Nov 13 '05 #1
2 2304
"Lyn" <lh******@ihug.com.au> wrote
The RecordSource property can only be
set to a table, query or SQL statement.
I need to be able to set it to the recordset.


Reconsider this statement. My guess is that you NEED to be able to bind the
form to particular records, and that the recordset you describe is ONE way
to obtain those records, but perhaps not the ONLY way. Then, consider how
you might rethink your design so that you select the same records as those
in the recordset in some other manner.

Larry Linson
Microsoft Access MVP

Nov 13 '05 #2
Lyn

"Larry Linson" <bo*****@localhost.not> wrote in message
news:1Mz3e.2341$Tm5.472@trnddc07...
"Lyn" <lh******@ihug.com.au> wrote
The RecordSource property can only be
set to a table, query or SQL statement.
I need to be able to set it to the recordset.


Reconsider this statement. My guess is that you NEED to be able to bind
the
form to particular records, and that the recordset you describe is ONE way
to obtain those records, but perhaps not the ONLY way. Then, consider how
you might rethink your design so that you select the same records as those
in the recordset in some other manner.

Larry Linson
Microsoft Access MVP


Hi Larry,
Thanks for your response. I take it that you are saying that binding an
imported recordset to a form cannot be done (despite what Help says about
the Recordset property, unless I have misread it).

I can't use Table in RecordSource because my fields come from two different
tables (this is where I am at now).

I can't use a stored query because the query is dynamically built in the
calling form based on user input.

I could use the SQL generated in the calling form and pass it to the form in
question (rather than the resulting recordset) via OpenArgs. This does
work, I have used it before. Is this the solution you were hinting at? The
only reservation I have is that it requires me to generate the same
recordset twice -- once in the calling form where I do some error checking
before calling the form in question, and then again in the new form so that
I can access the fields from both tables. If this is the only (or at least
the best) way to do it, then I will have to settle for that and take the
slight performance hit of having to access the database twice for the same
data. I just thought that there must be a more efficient way of doing this
(and maybe there is if I still haven't understood what you were hinting
at!).

Thanks again for the help.

--
Cheers,
Lyn.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: melanie | last post by:
Hi, I open a recordset with a SQL query as its source. Then, i set the listbox.recordset = to the recordset i just opened. But, the fields appear in the listbox columns in a different order...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
2
by: pwh777 | last post by:
I need help in understanding the DataAdapter Fill method and how it relates to the binding to controls on a form. I have a table called tbl_CID_XRef on SQL Server. I have written as a test the...
19
by: Larry Lard | last post by:
In the old days (VB3 era), there was a thing called the Data Control, and you could use it to databind controls on forms to datasources, and so (as the marketing speak goes), 'create database...
6
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
5
by: jonman | last post by:
Hello, I'm a bit of a newbie when it comes to Access (and DB's in general). I've got a form that allows the assembles a SQL string (that I've tested interactively, and proven that it returns...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
3
ADezii
by: ADezii | last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.