can this be done

teiben

Registered User.
Local time
Today, 23:54
Joined
Jun 20, 2002
Messages
462
I have a formA, which is based on TableA. After user selects their department from FormA, it opens Form B. How do I make Form B match the selected department in FormA. I'm sure it's stupid but I can't get this to work.
 
teiben,

DoCmd.OpenForm "FormB",,,"[FormBDept] = '" & Me.FormADept & "'"

Wayne
 
I'm getting the error message Runtime: 2424
The expression you entered has a field, control or property name that Microsoft can't find.

On form B(frmDataEntry), on open I put
frmLogon name of form A, cboDepartment is the control holding the Department and combo51 holds (or should) where I want the info. from FormA to go. HELP

DoCmd.OpenForm "frmLogon", , , "[cboDepartment] = '" & Me.Combo51 & "'"
 
try

DoCmd.OpenForm "frmLogon", , , "[cboDepartment] = " & Me.Combo51
 
Thanks.
Now I'm getting a 2491 error. The action or method is invalid becuase the form or report isn't bound to a table or query.

Both form A and form B are bound to a table, the same table. Does this make sense?
 
Teiben,

Have you tried this?

Rusty
:D

'*** open the form
DoCmd.OpenForm "FormB", acNormal, , "[ProjectReference] like '" & Me![reference] & "'"
'*** [ProjectReference] is the Control Source name of the field on the form that is being opened, i.e. FormB
'*** [reference] is the field name as it appears on the form you are opening from, i.e. FormA
 
Thank you, I'm really under the gun on this project.

It doesn't work! I'm sure the answer to so easy, but I can't see to get Form B to select the department that was picked on form A in the combo box. I've been trying "synching" 2 forms and that doesn't work either.

Does anyone have an example of this? I'm using 97
 
on my DB i have a main form which has employee details with a number of buttons for search and links to other forms, i would use this method as its easy to set up action buttons and link them how you want.

Private Sub Additional_Click()
On Error GoTo Err_Additional_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "AdditionalUniform"

stLinkCriteria = "[PayRollNo]=" & Me![PayRollNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Additional_Click:
Exit Sub

Err_Additional_Click:
MsgBox Err.Description
Resume Exit_Additional_Click

End Sub

the above is example code of what my button uses
This button on my db returns data only for the individual who's payroll no i am currently looking at
 
didn't work. I posted

I put this on a command button, on my FormA

On Error GoTo Err_Additional_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmDataentry"
'????both id's same
stLinkCriteria = "[lngUsrId]=" & Me![lngUsrId]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Additional_Click:
Exit Sub
Err_Additional_Click:
MsgBox Err.Description
Resume Exit_Additional_Click

End Sub

On the bottom of the form that opens, frmDataentry or form B, it stays Filtered, but person/department selected on Form A isn't the same as on form B
 
enough conditions?

Do you maybe need code that says join person and join department? Here's an example where I had four conditions that had to match.

Private Sub Command18_Click()
Me.Refresh
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_rice_detail"
stLinkCriteria = "[BaseCase Code]=" & "'" & Me![BaseCase Code] & "' and [Scenario]= " & Me!Scenario & "And [Rice Object]= '" & Me![Rice Object] & "'And [parameter]='" & Me![Parameter] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.Close acForm, "frm_parameter"

End Sub
 
teiben,

Is your combo multi-column?

DoCmd.OpenForm "FormB",,,"[FormBDept] = " & Me.cboDepartment.Column(0)

Wayne
 
How would you open one form with the results of another form? Form A and FormB. You have ComboA on Form and you want the choice on CombA put on ComboB or textboxB.
Help
 

Users who are viewing this thread

Back
Top Bottom