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

Printing a selected record

4
Hi!

How can I print the selected record? I'm using visual basic 6. After I search the record, it display in the form but when I click the print button all the records will print. What I want is to print the selected record only.

Thanks!
Jan 23 '07 #1
8 6005
sashi
1,754 Expert 1GB
Hi!

How can I print the selected record? I'm using visual basic 6. After I search the record, it display in the form but when I click the print button all the records will print. What I want is to print the selected record only.

Thanks!
Hi there,

Show us the code you included in the button click event, it's much easier you debug your code in that way, Good luck & Take care.
Jan 23 '07 #2
mci
4
This are the code for search button:
Private Sub cmdSearch_Click()
If OptWell.Value = True Then

Form1.Data1.Recordset.FindFirst "'" & TxtSearch.Text & "' = well"
End If
If OptJob.Value = True Then
Form1.Data1.Recordset.FindFirst "'" & TxtSearch.Text & "' = job"
End If
Unload Me
Form1.Show
End Sub


and this are for the print button:
Private Sub CmdPrint_Click()
DataReport1.Show
End Sub

the search and print command are working but I want to print only the selected record.
Thanks for your immediate response!
Jan 23 '07 #3
mci
4
I think I should create a program for the data report but I don't know what should I put on. pls help!!!
Jan 23 '07 #4
i think u jst need to use something like crystal report to do this
Jan 23 '07 #5
Killer42
8,435 Expert 8TB
i think u jst need to use something like crystal report to do this
Can't you just apply a filter to the datareport? (I'm not familiar with datareports, so can't say for sure.)
Jan 23 '07 #6
damdam
1
see the code below it will help you...
your datareport must set it source to the data environment that has a variable(text1.text) which will match and filter the record to be displayed in your datareport



If DataEnvironment3.rspayreg.State Then DataEnvironment3.rspayreg.Close
DataEnvironment3.payreg (Text1.Text)
DataReport3.Show
Jan 29 '07 #7
mci
4
Hi,

damdam, it works on my program. But I had a new problem.
I’m using VB form to add a record. After saving it, I used the datacombo to search for the newly recorded data and I can print also but if you add another record it doesn’t display in the datacombo. In order to see the newly added record I should close the program and run again.

Meaning it shows the saved record and can print it after compiling/running the program. I used data controller to store data and this are the code:

Private Sub CmdSave_Click()
MsgBox "Record Saved!"
Data1.Recordset.ADDNEW
Data1.Recordset.UPDATE
End Sub



For the datacombo (this are the code came from Deke):

Private Sub DataCombo1_Change()
If DataEnvironment1.rsCommand1.State Then DataEnvironment1.rsCommand1.Close
DataEnvironment1.Command1 DataCombo1.BoundText

DataCombo1.Refresh
Command1.Enabled = True
End Sub

Thanks,
mci
Jan 29 '07 #8
Hi!

How can I print the selected record? I'm using visual basic 6. After I search the record, it display in the form but when I click the print button all the records will print. What I want is to print the selected record only.

Thanks!
Mar 3 '07 #9

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

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
4
by: Sami | last post by:
I hope someone will tell me how to do this without having to do any VB as I know nothing in that area. I am a rank beginner in using Access. I have created a database consisting of student...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
5
by: John | last post by:
Hi If I have a form open, what is the code that is equivalent to using the File->Print menu with select record(s) option to print the form with the currently displayed record values? Thanks ...
5
by: martin DH | last post by:
Hello, I am using MS Access 2002-2003. I added a "Print Record" command button to a form in my database. Is there a way (via VBA or anything else) to open a print preview screen when the command...
8
by: wassimdaccache | last post by:
Hello everybody The name of the form that I'm working on is 'AddProduct' I'm trying to print a selected record that I have the focus, its name is "barecode" My report name is ...
3
by: Dave | last post by:
Hello! What's the best way to make a button print *just* the selected (displayed) record of a subform, when that subform is currently part of a larger form? Thanks!
0
by: nikhilgargi | last post by:
Requirement: I need to provide printing capability in a C# desktop application that I am developing The documents that need to be printed can be in Rich Text Format (RTF) or HTML. Custom...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.