473,803 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get values from a field shown in a single cell on a report?

9 New Member
Hi to everyone!

I'm actually a beginner in access/vba etc.

Like many of you, I also have a problem with something. That »something« is called »How to get values from a field in a table or a query shown in a single cell on a report? (They should be separated with commas and limited to a cell in a report)”.

If somebody knows the answer to this or knows the article about it, please , be so kind to reply an answer or direct me to some tutorial or etc.


Many thanks in advance.
Oct 17 '06 #1
13 2780
PEB
1,418 Recognized Expert Top Contributor
You want to et a value from a table/ query or from a field in a report?
Oct 21 '06 #2
MMcCarthy
14,534 Recognized Expert Moderator MVP
A report is not an interactive interface. It doesn't respond to clicking on it. You need to use a form for this.



Hi to everyone!

I'm actually a beginner in access/vba etc.

Like many of you, I also have a problem with something. That »something« is called »How to get values from a field in a table or a query shown in a single cell on a report? (They should be separated with commas and limited to a cell in a report)”.

If somebody knows the answer to this or knows the article about it, please , be so kind to reply an answer or direct me to some tutorial or etc.


Many thanks in advance.
Oct 23 '06 #3
Killer42
8,435 Recognized Expert Expert
A report is not an interactive interface. It doesn't respond to clicking on it. You need to use a form for this.
Perhaps the desired end could be achieved by using a query which mushes the multiple fields together into a single output field in the required format, then using this in the report.
Otherwise, as mmccarthy says, you probably need to use a form.
Oct 23 '06 #4
kdee
9 New Member
For now I (and people who helped me ) achieved to put up something like this.


Private Sub Report_Open(Can cel As Integer)
'------------------------------------------------------------
' Dodaj_stevilke_ faktur_na_repor t
'
'------------------------------------------------------------
On Error GoTo Dodaj_stevilke_ faktur_na_repor t_Err

Dim rs As Recordset
Dim MyStr As String
Dim FirstRec As Boolean
Dim Responce
Dim okno As TextBox
set okno = [Report_Faktura-lot-osnovna].CMR_ji
Set rs = CurrentDb.OpenR ecordset("SELEC T [CMR-ji za fakturo].[CMR] FROM [CMR-ji za fakturo];")
If rs.RecordCount > 0 Then
MyStr = ""
FirstRec = True
While Not rs.EOF
If FirstRec Then
MyStr = rs![CMR]
Else
MyStr = MyStr & ", " & rs![CMR]
End If
rs.MoveNext
Wend
End If
rs.Close
Set rs = Nothing
Responce = MsgBox("My String = " & MyStr, vbOKOnly, " Example")

okno.value = MyStr

Dodaj_stevilke_ faktur_na_repor t_Exit:
Exit Sub

Dodaj_stevilke_ faktur_na_repor t_Err:
MsgBox Error$
Resume Dodaj_stevilke_ faktur_na_repor t_Exit

End Sub

There is a problem though. It shows an error "Too few parameters. Expected 1"

Any suggestions?

Thanks in advance
Oct 23 '06 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
try

okno.text = MyStr


For now I (and people who helped me ) achieved to put up something like this.


Private Sub Report_Open(Can cel As Integer)
'------------------------------------------------------------
' Dodaj_stevilke_ faktur_na_repor t
'
'------------------------------------------------------------
On Error GoTo Dodaj_stevilke_ faktur_na_repor t_Err

Dim rs As Recordset
Dim MyStr As String
Dim FirstRec As Boolean
Dim Responce
Dim okno As TextBox
set okno = [Report_Faktura-lot-osnovna].CMR_ji
Set rs = CurrentDb.OpenR ecordset("SELEC T [CMR-ji za fakturo].[CMR] FROM [CMR-ji za fakturo];")
If rs.RecordCount > 0 Then
MyStr = ""
FirstRec = True
While Not rs.EOF
If FirstRec Then
MyStr = rs![CMR]
Else
MyStr = MyStr & ", " & rs![CMR]
End If
rs.MoveNext
Wend
End If
rs.Close
Set rs = Nothing
Responce = MsgBox("My String = " & MyStr, vbOKOnly, " Example")

okno.value = MyStr

Dodaj_stevilke_ faktur_na_repor t_Exit:
Exit Sub

Dodaj_stevilke_ faktur_na_repor t_Err:
MsgBox Error$
Resume Dodaj_stevilke_ faktur_na_repor t_Exit

End Sub

There is a problem though. It shows an error "Too few parameters. Expected 1"

Any suggestions?

Thanks in advance
Oct 23 '06 #6
kdee
9 New Member
rs (recordset) has a value (rs = nothing) when i run throuhg line by line.



I don't think VBA recognizes the filed [CMR-ji za fakturo].[CMR] or even the query [CMR-ji za fakturo] which are members of a database.

It recognizes docmd.openquery "CMR-ji za fakturo" (it opens query)

but not like this docmd.openquery [cmr-ji za fakturo]



could it be the same with sql's select from? How could I then refer to a field (column) inside the "CMR-ji za fakturo"?



SELECT "cmr-ji za fakturo".cmr from "cmr-ji za fakturo" doesn't work.

Thanks in advance
Oct 30 '06 #7
MMcCarthy
14,534 Recognized Expert Moderator MVP

I don't think VBA recognizes the filed [CMR-ji za fakturo].[CMR] or even the query [CMR-ji za fakturo] which are members of a database.
Have you tried to run the query in the query window as follows:

SELECT CMR FROM [CMR-ji za fakturo];

What result do you get?
Oct 31 '06 #8
kdee
9 New Member
There is no problem in querying inside access mdb file.

SELECT CMR FROM [CMR-JI ZA FAKTURO]

works just fine in standard access query. It displays a column with all the data in it.

But I noticed that when I activate the vba procedure with the same select statement the query becomes empty. And it's probably the same reason why rs=nothing

Is there some need maybe to connect the querry with vba differently?

Thanks
Nov 2 '06 #9
PEB
1,418 Recognized Expert Top Contributor
Hey, are you macedonian or serbian???

;)
Nov 4 '06 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

13
3531
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to make a query that selects from a table as desribed below .. I have a table (Volunteer) that has a member field (memnumber) and a number of fields that are headed in various categories and are yes/no formated
1
2012
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title: Developer Address: 123 Main Street. After the table of information will be the web form. So basically I want to display the table and then have the web form.
2
2366
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title: Developer Address: 123 Main Street. After the table of information will be the web form. So basically I want to display the table and then have the web form.
13
2495
by: scorpion53061 | last post by:
Very urgent and I am very close but need a little help to get me over the edge........ I need to write these columns to a html file with each row containing these columns (seperated by breaks). Currently this code write all columns to a single row which works but is not what the boss wants. If anyone has suggestions how you would do a report like this I very much would like to hear them as well. vb.net windows app. ...
1
2502
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs fine). There is then a combo box they can select a field from (eg CompanyID etc) and then the list box below that contains the values (eg Microsoft, Novell etc). These are all multi-select list boxes. Now I can get the code to work if the user...
2
12081
by: Pete | last post by:
I need to create a single query (Not a SQL query) against a single table that counts the number of records in the table, where the single field "tmp" contains specific string values If the field contains "AAA" the count is X. if the field contains "CCC" the count is Y. if the field contains "Stop" then count is Z. I have tried several ways and can not seem to get any where. I get the same count for all string values. Can some one...
1
4591
by: dan.cawthorne | last post by:
Kinda Confused to why i cant get a single text field to add up all the Projects that are filtered Via a Query. I Have a Query Based on a Projects Table. The Query Have a Criteria To Select a Estimator, Which Then List all the Projects that Estimator as worked on. When Then Opens a List Type Report thats Shows all The Projects Related to that User. and that Report Theres a Field called
3
4629
by: kstevens | last post by:
I have created a report that looks like a spreadsheet. The only problem is that when one of the cell grows (cangrow property is yes) then the lines beside them are not long enough. I tried this code in the on format event of the form detail section Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Me.Line96.Height = Me.description.Height Me.Line95.Height = Me.description.Height Me.Line94.Height =...
0
9700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10546
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.