Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting data

Status
Not open for further replies.

lidehall

Programmer
Feb 11, 2004
34
SE
Hi, i have a table with data (columns with company number and phone id, ip=1,digital=2,analogue=3)
I have created a form with a sql statement that gets the company number. Now each time you select one of the companys in the scrollbar I want toprint out the corresponding phone id. One company can have several phone id's. For example
Company: Phone id

Microsoft 1,2,3,4,1,2,4
Hardsoft 4,4,5,1,2,4,2,3
Volvo 1,1,1,1,1,1,5,1
and so on...

Is this possible?

Best regards

L.H DC
 
lidehall

If I understand you correctly, you have a one-to-many relationship between the company and phone information - one company can have many phone numbers.

"...each time you select one of the companys in the scrollbar..." implies you are using a contineous form.

I am going to assume that "toprint out the corresponding phone id" means you want to print a report.

Moving on...
You can use the event procedure "On current" record to start your report. One approach is to create a query using the query builder tool. Inlcude your customer / vender table and your phone info table. Save the query, and use the report wizard to create your report using the saved query.

The wizard will most of the work for you, but here is something along the lines as to what to expect...

Code:
    Dim stDocName As String
    Dim intCID As Long

    If Not IsNull(Me.customer_id) Then
        intCID = Me.customer_id
        stDocName = "customer_rpt"
        DoCmd.OpenReport stDocName, acNormal, , "cusomter_id = " & intCID
    End If

This will make the run the report for the one customer. As long as your query is correct, it should work.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top