Form Problem

  • Thread starter Thread starter ckunerth
  • Start date Start date
C

ckunerth

I have a database that contains companies and employees. I have
created a form that will allow the user to select the company and pull
a report of the employees at that company. My problem is that the data
changes without me making changes. I will pull the list of a company
and an employee that is not with that company will be listed on the
report for another company. I have no clue as to what is happening.
Does anyone have any suggestions or advice?
 
What is the query used to pull your report? Post the SQL view here.

--
Hope that helps!

RBear3
.






- Show quoted text -

I am not using a query to run the report. I am using the
DoCmd.OpenReport function to open the report based on which company is
selected on the form.
 
ok, then post that line here.

If you are properly filtering the report it should pull the appropriate
company and contacts. I assume your contacts are in a separate table and
have a one-to-many relationship with your companies?
 
ok, then post that line here.

If you are properly filtering the report it should pull the appropriate
company and contacts. I assume your contacts are in a separate table and
have a one-to-many relationship with your companies?

--
Hope that helps!

RBear3
.







- Show quoted text -

I am only using 1 table that contains both companies and employees.
Below is the code to pull the report based on the company selected on
the form.

Private Sub Command21_Click()
On Error GoTo Err_Command21_Click

Dim strMsg As String, strTitle As String
Dim intStyle As Integer
Dim strDocName As String, strLinkCriteria As String

' If CompanyName control is blank, display a message.
If IsNull(Me![Company]) Then
strMsg = "Please Select a Company to search by and then click
search by Company again."
intStyle = vbOKOnly
strTitle = "Select a Company"
MsgBox strMsg, intStyle, strTitle
Me![Company].SetFocus
Else
' Otherwise, open Trainee form, showing products for current
supplier.
strDocName = "Trainee Information Form"
strLinkCriteria = "[Company] = Forms![searchbycompany3]!
[Company]"
DoCmd.OpenReport strDocName, acViewPreview, , strLinkCriteria
DoCmd.MoveSize (1440 * 0.78), (1440 * 1.8)


End If

Exit_Command21_Click:
Exit Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top