Re: Code assistance
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Wed, 11 Apr 2007 14:38:40 -0500
ladybug via AccessMonster.com wrote:
I have a code that I found that I am trying to modify to my database. This
is the code:
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Time***"
stLinkCriteria = "[EmployeeName]=" & "'" & Me![cboSearch] & "'"
stLinkCriteria = "[WeekRange]=" & "'" & Me![Text22] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
I have a form with two combo boxes. The first one is cboSearch where you
select an Employee. The second is Text22 where you select a weekrange. Once
both selections are made the on click code for the command button has this
Event Procedure and it opens another form. I want the Employee and Weekrange
selected in the first form, to populate when opening the second form.
Right now with the code above it is only reading the WeekRange. No matter
what EmployeeName I select it only shows the first Employee name from my
table.
You need to combine the criteria instead of resetting it.
stLinkCriteria = "EmployeeName='" & Me!cboSearch & "'" _
" AND WeekRange='" & Me!Text22 & "'"
--
Marsh
MVP [MS Access]
.
- Follow-Ups:
- Re: Code assistance
- From: ladybug via AccessMonster.com
- Re: Code assistance
- References:
- Code assistance
- From: ladybug via AccessMonster.com
- Code assistance
- Prev by Date: Re: Concatenate & transfer data by command button in VBA
- Next by Date: Re: Dlookup and update not working correctly
- Previous by thread: Code assistance
- Next by thread: Re: Code assistance
- Index(es):