Can't see value in unbound text box & filtering a continuous form

S

scadav

I really was hoping someone could help me solve a problem and give me a
suggestion:

I have 2 forms:

Employees
EmployeesActivity

When in the Employees form, I click a button that opens up the
EmployeesActivity.

The EmployeesActivity is a continuous form that has a list of the
activity this employee has performed. On click, the DatabaseID from
the Employees Form should get populated into an unbound text box called
[txt_DatabaseID]. I do this as follows:


Private Sub bt_EmployeeActivity_Click()
On Error GoTo Err_bt_EmployeeActivity_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EmployeesActivity"

stLinkCriteria = "[DatabaseID]=" & Me![DatabaseID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!EmployeesActivity.txt_DatabaseID = Forms!Employees.DatabaseID


Exit_bt_EmployeeActivity_Click:
Exit Sub

Err_bt_EmployeeActivity_Click:
MsgBox Err.Description
Resume Exit_bt_EmployeeActivity_Click

End Sub


From there the EmployeesActivity form has a record source set to a
query. The query reads as follows:

SELECT EmployeesActivity.ActivityID, EmployeesActivity.DatabaseID,
EmployeesActivity.Activty, EmployeesActivity.ActivityDate,
EmployeesActivity.ReviewType, EmployeesActivity.IncidentType
FROM EmployeesActivity
WHERE
(((EmployeesActivity.DatabaseID)=[Forms]![EmployeesActivity]![txt_DatabaseID])
AND ((EmployeesActivity.DeletedActivity)=False));

From here (hoping), I should get a list of all activity associated with
this employee.

I have 1 problem & 1 question:

#1 - When I click the button from the Employees form, the unbound text
box does get the DatabaseID from the previous form, but I am unable to
see it. I know the id is there for 2 reasons: 1. When I click in
the text box the cursor will be placed somewhere after the number. If
I highlight the rest of the text box (moving to the left) and copy and
paste, into notepad, I will see the number in notepad. 2. If I
minimize the screen and then restore it, I am able to see the number.

#2 - Is setting the record source to a query, the best way to filter
all records on a continuous form?

Thanks in advance.

Dave
 
G

Guest

Why not just use the EmployeesActivity form as a subform and use DatabaseID
as your Master/Child link?

scadav said:
I really was hoping someone could help me solve a problem and give me a
suggestion:

I have 2 forms:

Employees
EmployeesActivity

When in the Employees form, I click a button that opens up the
EmployeesActivity.

The EmployeesActivity is a continuous form that has a list of the
activity this employee has performed. On click, the DatabaseID from
the Employees Form should get populated into an unbound text box called
[txt_DatabaseID]. I do this as follows:


Private Sub bt_EmployeeActivity_Click()
On Error GoTo Err_bt_EmployeeActivity_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EmployeesActivity"

stLinkCriteria = "[DatabaseID]=" & Me![DatabaseID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!EmployeesActivity.txt_DatabaseID = Forms!Employees.DatabaseID


Exit_bt_EmployeeActivity_Click:
Exit Sub

Err_bt_EmployeeActivity_Click:
MsgBox Err.Description
Resume Exit_bt_EmployeeActivity_Click

End Sub


From there the EmployeesActivity form has a record source set to a
query. The query reads as follows:

SELECT EmployeesActivity.ActivityID, EmployeesActivity.DatabaseID,
EmployeesActivity.Activty, EmployeesActivity.ActivityDate,
EmployeesActivity.ReviewType, EmployeesActivity.IncidentType
FROM EmployeesActivity
WHERE
(((EmployeesActivity.DatabaseID)=[Forms]![EmployeesActivity]![txt_DatabaseID])
AND ((EmployeesActivity.DeletedActivity)=False));

From here (hoping), I should get a list of all activity associated with
this employee.

I have 1 problem & 1 question:

#1 - When I click the button from the Employees form, the unbound text
box does get the DatabaseID from the previous form, but I am unable to
see it. I know the id is there for 2 reasons: 1. When I click in
the text box the cursor will be placed somewhere after the number. If
I highlight the rest of the text box (moving to the left) and copy and
paste, into notepad, I will see the number in notepad. 2. If I
minimize the screen and then restore it, I am able to see the number.

#2 - Is setting the record source to a query, the best way to filter
all records on a continuous form?

Thanks in advance.

Dave
 
S

scadav

Two questions:

1. By mater/child link are you referring to setting up a relationship?

2. There is no more room on the form for the subform, so I was just
wanted to setup a separate form all together.
 
G

Guest

Tables have relations and forms-subforms are link as Master/Child in a
similar fashion.

You might look into adding tabs to the form and link that way.
 

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

Top