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

i want to print a current data in my entry ms access

i have made a database in petty cash but every time i click the button it prints all the records i want to print the current entry only please help me

here are my fields
Petty Cash Entry
ID - Primary key
NameID
Department
Badge ID
Amount
Amount in Words
Reason in Support
Cost Allocation
Cost Department
name of the report Petty Cash

hope you can help me thanks a lot
Aug 10 '14 #1
18 1156
jimatqsi
1,271 Expert 1GB
klengot0119,
welcome to Bytes.com. Show us the code you are using to print and you'll get the change you need.

It may help you to know that the DoCMD.OpenReport instruction includes a parameter for a where string to limit the report data.

Jim
Aug 10 '14 #2
I'm finding it hard to print the current data hope you could help me thanks so much.
Aug 10 '14 #3
NeoPa
32,556 Expert Mod 16PB
I have removed the code you posted as it was clearly typed free-hand and not copied from your project. Please copy the code from your project and Paste it in here. Free-hand posted code is the cause of many wasted hours as it is very rarely accurate (as was illustrated by the code you posted) and leads to time wasted dealing with non-existent issues.

Please ensure the code you post is the code that is causing you problems.
Aug 10 '14 #4
twinnyfo
3,653 Expert Mod 2GB
klengot0119,

Are you able to post the code you are using as requested? This sounds like a relatively simple solution, if we had something to go on.....
Aug 12 '14 #5
actually i'm not expert in making access database i hope you can help me what code you are looking for?
Aug 13 '14 #6
twinnyfo
3,653 Expert Mod 2GB
We can't help you unless we see what you have already tried. This is not a site for having others do the work for you. If you post your current code, we can work through a solution.
Aug 13 '14 #7
you mean the code in the event field on property sheet on click?

Private Sub cmdPrint_Click()

DoCmd.OpenReport "Petty Cash", acViewNormal, , "[ID] = " & Me.ID

End Sub
Aug 13 '14 #8
twinnyfo
3,653 Expert Mod 2GB
And even with the WHERE Clause of

Expand|Select|Wrap|Line Numbers
  1. "[ID] = " & Me.ID
It still shows all records? With that clause, I would expect only one of two things:

1. Only the record with ID = to the ID of the Form would show, or
2. No records would show, as the ID could not be found.

Is your form bound to a table or a query based on the Table? It shouldn't have anything to do with the results you are getting.... Also confirming that [ID] is an underlying field of both the Form and the Report's record source.

Just based on your description, I can only imagine that everything is "built correctly", but this is certainly odd.

Is there any code in the Report which may be resetting the recordsource to all records?
Aug 13 '14 #9
can i send you print screen of my database so that you can see whats wrong to my problem? so that you can visualize how it looks like
Aug 13 '14 #10
when i click the print button nothing shows
Aug 13 '14 #11
jimatqsi
1,271 Expert 1GB
Are you printing the ID on the report? It would be interesting to see what value each record has for ID.

Are you seeing any messages pop up between clicking the print button and the appearance of the report?
Aug 13 '14 #12
twinnyfo
3,653 Expert Mod 2GB
Between your first post and Post #8, is that where you added the "[ID] = " & Me.ID parameter?

Your final result (no records) indicatees that either your form does not have the ID field available to it or that the Report does not.

It would be useful to all if we could see the query behind the form and the report (if there is a query). Or, if you have both tied directly to the Table, then I can only assume you have text boxes for each of the fields listed in your first post?
Aug 13 '14 #13
jimatqsi
1,271 Expert 1GB
Oh, excuse me for the cross-post. So instead of
Expand|Select|Wrap|Line Numbers
  1. "[ID] = " & Me.ID
try
Expand|Select|Wrap|Line Numbers
  1. "[ID] = " & 123 
but type some ID number that you know exists where I have put 123.

That will print your report with that one ID value shown if the report knows what an ID value is. After you prove that is okay, then look at why the form is not passing the correct ID to the instruction you have correctly entered.

Are you sure ID is actually on the form itself? It must be in order for this to work.
Aug 13 '14 #14
twinnyfo
3,653 Expert Mod 2GB
Hey Jim, congrats on Post #1,000!
Aug 13 '14 #15
jimatqsi
1,271 Expert 1GB
Oh, wow, cool :) Maybe it's time for another article to celebrate.
Aug 13 '14 #16
jimatqsi
1,271 Expert 1GB
klengot0119, please explain what the solution was.
Aug 13 '14 #17
i didn't make a query for this its only to enter then print i have text boxes for each of the fields listed only primary key is different
Aug 13 '14 #18
NeoPa
32,556 Expert Mod 16PB
Sorry to reset your post Jim, but I suspect the OP is having some difficulty using the site correctly. You guys are doing a great job helping them - both with how to post and with their project. Keep it up.

@Jim.
Congratulations on hitting four digits. Way to go mate!!
Aug 14 '14 #19

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

Similar topics

5
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and...
12
by: Jerry Weinstein | last post by:
Hi, I know about stored procedures and that they can speed up data entry via the SQL 'insert ' statement. However, one drawback to this method is that using the stored procedure still requires...
2
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5...
3
by: Randy | last post by:
I want to set up a table where I can enter dates that will prevent data entry of Dates in the Main table. I have done this in Approach by linking two tables and setting up a validation formula...
2
by: Bruce Richardson | last post by:
I've read many posts on TheScripts tonight and feel like I'm getting closer to the answer I need. I'm a newbie just trying to accomplish a specific problem. I'm putting on a conference for 250 ham...
1
by: hims | last post by:
hi i want to retrieve data from access through vb6.0 program but its not working. either sort out my error or help me with correct coding. thanks in advance !!!!!!! mail me at...
2
by: =?Utf-8?B?R3JlZw==?= | last post by:
I'm from an Access background and I'm working with VB.Net. In MS Access I can restrict data-entry into my fields on a form using the Format property. Is there an equivilant in VB.Net. I want to...
13
by: boliches | last post by:
I am trying to alert a user , by using a message box, to state the various missing data.This works OK except when all data is entered as appropriate I still get the "Warning Message" for missing...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.