473,320 Members | 1,978 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,320 software developers and data experts.

Displaying two records on one row of a form

Hi there,

I have a form in an Access project that contains a subform which
displays the results of a query of the style "select * from [table]
where [datefield] = #a certain date#". In the main part of the form
the user can change the date, which will force a requery in the
subform to bring up records from the date selected.

My question is this... The query in the subform is a very simple one,
with only three fields being returned. In the interest of saving
space -- or rather, of displaying more records on-screen in the
subform without the user having to scroll -- I'd like to show two
records across one row of the subform.

That is, I'd like the subform to have 6 columns instead of 3, with two
"groups" of 3 columns so two records can be displayed in one row.
However, I'm not sure if this is possible -- if I set up the subform
to have two "RecDate" fields, and two of each of the other fields, I
obviously just get the same record repeated twice across the row.

It's not crucial as it's an esthetic thing and not a functional one,
but if there's a simple way to do this I'd love to know how... any
suggestions are appreciated!

Thanks!

Matt K.
Nov 12 '05 #1
6 4038
> That is, I'd like the subform to have 6 columns instead of 3, with two
"groups" of 3 columns so two records can be displayed in one row.
However, I'm not sure if this is possible -- if I set up the subform
to have two "RecDate" fields, and two of each of the other fields, I
obviously just get the same record repeated twice across the row.


Matt,
AFAIK this is not possible.
-- Perhaps you could use two subforms ?
-- Perhaps it is possible to place your subform to the left or the right of your mainform?

--
Hope this helps
Arno R

Nov 12 '05 #2
"Matt K." wrote:
Hi there,

I have a form in an Access project that contains a subform which
displays the results of a query of the style "select * from [table]
where [datefield] = #a certain date#". In the main part of the form
the user can change the date, which will force a requery in the
subform to bring up records from the date selected.

My question is this... The query in the subform is a very simple one,
with only three fields being returned. In the interest of saving
space -- or rather, of displaying more records on-screen in the
subform without the user having to scroll -- I'd like to show two
records across one row of the subform.

That is, I'd like the subform to have 6 columns instead of 3, with two
"groups" of 3 columns so two records can be displayed in one row.
However, I'm not sure if this is possible -- if I set up the subform
to have two "RecDate" fields, and two of each of the other fields, I
obviously just get the same record repeated twice across the row.

It's not crucial as it's an esthetic thing and not a functional one,
but if there's a simple way to do this I'd love to know how... any
suggestions are appreciated!

Thanks!

Matt K.


Sure you can. With a good bit of skull sweat you can do most anything
database related in Access. And I doubt you'd find a single person in
this group that would want to do what you propose.
Adding/editting/deleting records would be a chore. The result would be an
ugly kludge. You would need to be a VBA guru to do it. And you'd waste
time designing and writing your kludge and then your work would suffer and
you'd be unproductive and your bosses would notice it and lay you off and
you'd be unemployed and you would sit at home dialing new employers while
wondering why you ever decided to put two records on one row.
Nov 12 '05 #3
Salad <oi*@vinegar.com> wrote in message news:<3F**************@vinegar.com>...

Sure you can. With a good bit of skull sweat you can do most anything
database related in Access. And I doubt you'd find a single person in
this group that would want to do what you propose.
Adding/editting/deleting records would be a chore. The result would be an
ugly kludge. You would need to be a VBA guru to do it. And you'd waste
time designing and writing your kludge and then your work would suffer and
you'd be unproductive and your bosses would notice it and lay you off and
you'd be unemployed and you would sit at home dialing new employers while
wondering why you ever decided to put two records on one row.


Thanks (to Arno as well) for the quick replies, much appreciated!

I figured based on my level of Access knowledge -- fairly experienced
user, but not "formally" trained -- that what I had in mind was either
impossible (or so complicated as to be effectively impossible) or
something obvious that I'd overlooked.

By posting the question I was to trying to ensure it wasn't the
latter. :)

Thanks again, and Happy New Year!

--Matt
Nov 12 '05 #4
DFS

"Matt K." <ma*******@yahoo.com> wrote in message
news:65**************************@posting.google.c om...
Hi there,

I have a form in an Access project that contains a subform which
displays the results of a query of the style "select * from [table]
where [datefield] = #a certain date#". In the main part of the form
the user can change the date, which will force a requery in the
subform to bring up records from the date selected.

My question is this... The query in the subform is a very simple one,
with only three fields being returned. In the interest of saving
space -- or rather, of displaying more records on-screen in the
subform without the user having to scroll -- I'd like to show two
records across one row of the subform.

That is, I'd like the subform to have 6 columns instead of 3, with two
"groups" of 3 columns so two records can be displayed in one row.
However, I'm not sure if this is possible -- if I set up the subform
to have two "RecDate" fields, and two of each of the other fields, I
obviously just get the same record repeated twice across the row.

It's not crucial as it's an esthetic thing and not a functional one,
but if there's a simple way to do this I'd love to know how... any
suggestions are appreciated!


Simple to do, but kind of unusual and not recommended. Instead, do a Top 2
query and show two records as they appear in the table: 2 rows of 3 columns
each.

If you want to try the 2-on-1-row thing, this is one way (assumes you don't
know how many records will match your #certain date# value):

1) create a query to get the Top 1 record matching your #certain date#
2) create another query getting the Top 2 records matching the #certain
date#, and not matching the Top 1 (ie if there are at least two matching
records, this query will return one record)
3) create a third query combining all the fields from the first two queries
(do a left join from query 1 to query 2, on the #certain date# field, in
case query 2 doesn't return anything)
4) base your subform on the third query

You might add a blank field between the groups of 3 fields, to help indicate
visually the separate records.


Nov 12 '05 #5
ma*******@yahoo.com (Matt K.) wrote in
news:65**************************@posting.google.c om:
Hi there,

I have a form in an Access project that contains a subform which
displays the results of a query of the style "select * from [table]
where [datefield] = #a certain date#". In the main part of the form
the user can change the date, which will force a requery in the
subform to bring up records from the date selected.

My question is this... The query in the subform is a very simple one,
with only three fields being returned. In the interest of saving
space -- or rather, of displaying more records on-screen in the
subform without the user having to scroll -- I'd like to show two
records across one row of the subform.

That is, I'd like the subform to have 6 columns instead of 3, with two
"groups" of 3 columns so two records can be displayed in one row.
However, I'm not sure if this is possible -- if I set up the subform
to have two "RecDate" fields, and two of each of the other fields, I
obviously just get the same record repeated twice across the row.

It's not crucial as it's an esthetic thing and not a functional one,
but if there's a simple way to do this I'd love to know how... any
suggestions are appreciated!


SELECT SubQuery.fldTransactionID,
First(SubQuery.Date1) AS Date1,
First(SubQuery.Date2) AS Date2
FROM
[SELECT t1.fldTransactionID,
t1.fldDate AS Date1,
t2.fldDate AS Date2
FROM tbl2002Transactions AS t1
LEFT JOIN tbl2002Transactions AS t2
ON t2.fldTransactionID > t1.fldTransactionID]. SubQuery
WHERE Filter(fldTransactionID)<>0
GROUP BY SubQuery.fldTransactionID

Public Function Filter(ByVal vID As Long)
Static ID As Long
Static Counter As Long
If ID > vID Then Counter = 0
ID = vID
Counter = Counter + 1
Filter = Counter Mod 2
End Function

This shows Date1 from first record), Date2 (from second record)
Date3, Date4
Date5, Date6
etc.

It's interesting as a Sunday morning recreation, but I can't imagine ever
using it.

If you should decide to try to use this, please note that the syntax of the
Subquery, including the initial "[" and the closing closing "] dot space
alias" is required. If you don't like [ and ], you may use ` instead, I
believe.
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #6
Lyle Fairfield <Mi************@Invalid.Com> wrote in
news:Xn*******************@130.133.1.4:
ma*******@yahoo.com (Matt K.) wrote in
news:65**************************@posting.google.c om:
Hi there,

I have a form in an Access project that contains a subform which
displays the results of a query of the style "select * from [table]
where [datefield] = #a certain date#". In the main part of the form
the user can change the date, which will force a requery in the
subform to bring up records from the date selected.

My question is this... The query in the subform is a very simple one,
with only three fields being returned. In the interest of saving
space -- or rather, of displaying more records on-screen in the
subform without the user having to scroll -- I'd like to show two
records across one row of the subform.

That is, I'd like the subform to have 6 columns instead of 3, with two
"groups" of 3 columns so two records can be displayed in one row.
However, I'm not sure if this is possible -- if I set up the subform
to have two "RecDate" fields, and two of each of the other fields, I
obviously just get the same record repeated twice across the row.

It's not crucial as it's an esthetic thing and not a functional one,
but if there's a simple way to do this I'd love to know how... any
suggestions are appreciated!


SELECT SubQuery.fldTransactionID,
First(SubQuery.Date1) AS Date1,
First(SubQuery.Date2) AS Date2
FROM
[SELECT t1.fldTransactionID,
t1.fldDate AS Date1,
t2.fldDate AS Date2
FROM tbl2002Transactions AS t1
LEFT JOIN tbl2002Transactions AS t2
ON t2.fldTransactionID > t1.fldTransactionID]. SubQuery
WHERE Filter(fldTransactionID)<>0
GROUP BY SubQuery.fldTransactionID

Public Function Filter(ByVal vID As Long)
Static ID As Long
Static Counter As Long
If ID > vID Then Counter = 0
ID = vID
Counter = Counter + 1
Filter = Counter Mod 2
End Function

This shows Date1 from first record), Date2 (from second record)
Date3, Date4
Date5, Date6
etc.

It's interesting as a Sunday morning recreation, but I can't imagine
ever using it.

If you should decide to try to use this, please note that the syntax of
the Subquery, including the initial "[" and the closing closing "] dot
space alias" is required. If you don't like [ and ], you may use `
instead, I believe.


OOPS /// while this query will run without any problems on my machine, it
will not save from the query wizard window. Access crashes.

It will, however save thus:

Sub temp()
Dim sql As String
sql = sql & "SELECT SubQuery.fldTransactionID,"
sql = sql & vbNewLine
sql = sql & "First(SubQuery.Date1) AS Date1,"
sql = sql & vbNewLine
sql = sql & "First(SubQuery.Date2) As Date2"
sql = sql & vbNewLine
sql = sql & "FROM"
sql = sql & vbNewLine
sql = sql & "[SELECT t1.fldTransactionID,"
sql = sql & vbNewLine
sql = sql & "t1.fldDate AS Date1,"
sql = sql & vbNewLine
sql = sql & "t2.fldDate AS Date2"
sql = sql & vbNewLine
sql = sql & "FROM tbl2002Transactions AS t1"
sql = sql & vbNewLine
sql = sql & "LEFT JOIN tbl2002Transactions AS t2"
sql = sql & vbNewLine
sql = sql & "ON t2.fldTransactionID > t1.fldTransactionID]. SubQuery"
sql = sql & vbNewLine
sql = sql & "WHERE Filter(fldTransactionID) <> 0"
sql = sql & vbNewLine
sql = sql & "GROUP BY SubQuery.fldTransactionID"
CurrentProject.Connection.Execute "CREATE PROCEDURE Query6 AS " & sql
End Sub

It runs fine, but cannot be saved from the query wizard sql window.

Didn't try saving it with DAO, but it is saved properly using ADO as above.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #7

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

Similar topics

1
by: Tim Graichen | last post by:
Good morning, I have a sub-form that displays records from a table as a continuous form. The table has several hundred records, but the subform only displays five or six records. The records do...
3
by: Robin S. | last post by:
I tried to ask this question several days ago, but I didn't explain my application correctly. Basically I want to have one record from table "A" and I want to display, say, 5 records from table...
5
by: Robert | last post by:
Hello Accessors I have some reports created in Access that are very good for what they do. However, it seems to me that when you are displaying information you don't need to print out that a...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
9
by: Susan Bricker | last post by:
Greetings. I am having trouble populating text data that represents data in my table. Here's the setup: There is a People Table (name, address, phone, ...) peopleID = autonumber key There...
3
by: Lyn | last post by:
I need some guidance for a technique that will allow me to accomplish the following... I have a table in which each record contains a photograph. I would like to display in a form a thumbnail...
0
by: darrel | last post by:
Hi there, good day! i need some help in displaying my records,,, my assignment is i have to display a database records in a labels. Its like this in my database i have a table called "SUBJECTS"...
1
by: dheroan | last post by:
Hi there, I'm fairly new to using databases with VB .NET. I'm currently working on an application using a Microsoft Access database as a data source. I have created a form to display the fields...
0
by: John Kirkpatrick | last post by:
Hi all, I am having difficulty displaying records on a frontend MS Access 2000 form using a MySQL backend. The following code works well with the Jet database engine but doesn't work properly...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.