473,218 Members | 1,472 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,218 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 4032
> 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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.