ComboBox Value used in the next form

G

Guest

I have this question:

I have a form where the field is Combo1 and it has a source like this:

SELECT Users.UserID, [LastName] & " , " & [FirstName] AS Name,
Users.Password, Users.OrderPerson, Users.ApproverPerson,
Users.ReceiverPerson, Users.AdminPerson, Users.Active FROM Users WHERE
(((Users.Active)=Yes)) Or (((Users.Active)=Yes)) ORDER BY Users.Password;

this field only shows colum 2 where the data are:[LastName] & " , " &
[FirstName] AS Name (this form is mamed PASSWORD and I want to open another
form but I want that when I click the Icon of the "orders" form it pulls the
combo1 information, in the "orders"


anybody can help me?
I will apreciate so much, if you need more information please repy to this
group.
Ldiaz
 
G

Guest

With the command line to open te second form you can send values using the
OpenArgs.
================================
docmd.OpenForm "FormName",,,,,,OpenArgs
So
Docmd.OpenForm "FormName",,,,,,Me.ComboName.Column(1)
The column number stand for the position of this column in the combo row
source, start with 0. So the 1 pass the name parameter
================================
In the second form you can always refer to this value that you passing as
Me.OpenArgs
================================
 
G

Guest

Hi Ofer,thank you for your help, but it does work, I don't nkow why, here is
the statements that I had, could you check it and let me know what is
incorrect please.

[ud] is the name in the "Orders" Form
[combo1] is the name that I want to pull.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub OpenOrders_Click()
On Error GoTo Err_OpenOrders_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"
stLinkCriteria = "[ud]= & Me![Combo1]"


DoCmd.OpenForm stDocName, , stLinkCriteria



Exit_OpenOrders_Click:
Exit Sub

Err_OpenOrders_Click:
MsgBox Err.Description
Resume Exit_OpenOrders_Click

End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ofer said:
With the command line to open te second form you can send values using the
OpenArgs.
================================
docmd.OpenForm "FormName",,,,,,OpenArgs
So
Docmd.OpenForm "FormName",,,,,,Me.ComboName.Column(1)
The column number stand for the position of this column in the combo row
source, start with 0. So the 1 pass the name parameter
================================
In the second form you can always refer to this value that you passing as
Me.OpenArgs
================================
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
I have this question:

I have a form where the field is Combo1 and it has a source like this:

SELECT Users.UserID, [LastName] & " , " & [FirstName] AS Name,
Users.Password, Users.OrderPerson, Users.ApproverPerson,
Users.ReceiverPerson, Users.AdminPerson, Users.Active FROM Users WHERE
(((Users.Active)=Yes)) Or (((Users.Active)=Yes)) ORDER BY Users.Password;

this field only shows colum 2 where the data are:[LastName] & " , " &
[FirstName] AS Name (this form is mamed PASSWORD and I want to open another
form but I want that when I click the Icon of the "orders" form it pulls the
combo1 information, in the "orders"


anybody can help me?
I will apreciate so much, if you need more information please repy to this
group.
Ldiaz
 
G

Guest

If what you want is to use the combo in the criteria then the combo name
should be outside the quotes, and just to make sure, you said that the ud is
a name of the form, I hope you ment that it the ud is the name of the User Id
field in the Order form.

' Use if ud number
stLinkCriteria = "[ud]=" & Me![Combo1]
' Use if ud text
stLinkCriteria = "[ud]='" & Me![Combo1] & "'"

DoCmd.OpenForm stDocName, , stLinkCriteria


--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
Hi Ofer,thank you for your help, but it does work, I don't nkow why, here is
the statements that I had, could you check it and let me know what is
incorrect please.

[ud] is the name in the "Orders" Form
[combo1] is the name that I want to pull.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub OpenOrders_Click()
On Error GoTo Err_OpenOrders_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"
stLinkCriteria = "[ud]= & Me![Combo1]"


DoCmd.OpenForm stDocName, , stLinkCriteria



Exit_OpenOrders_Click:
Exit Sub

Err_OpenOrders_Click:
MsgBox Err.Description
Resume Exit_OpenOrders_Click

End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ofer said:
With the command line to open te second form you can send values using the
OpenArgs.
================================
docmd.OpenForm "FormName",,,,,,OpenArgs
So
Docmd.OpenForm "FormName",,,,,,Me.ComboName.Column(1)
The column number stand for the position of this column in the combo row
source, start with 0. So the 1 pass the name parameter
================================
In the second form you can always refer to this value that you passing as
Me.OpenArgs
================================
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
I have this question:

I have a form where the field is Combo1 and it has a source like this:

SELECT Users.UserID, [LastName] & " , " & [FirstName] AS Name,
Users.Password, Users.OrderPerson, Users.ApproverPerson,
Users.ReceiverPerson, Users.AdminPerson, Users.Active FROM Users WHERE
(((Users.Active)=Yes)) Or (((Users.Active)=Yes)) ORDER BY Users.Password;

this field only shows colum 2 where the data are:[LastName] & " , " &
[FirstName] AS Name (this form is mamed PASSWORD and I want to open another
form but I want that when I click the Icon of the "orders" form it pulls the
combo1 information, in the "orders"


anybody can help me?
I will apreciate so much, if you need more information please repy to this
group.
Ldiaz
 
G

Guest

One more thing, the open form line should be

DoCmd.OpenForm stDocName, , ,stLinkCriteria
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
Hi Ofer,thank you for your help, but it does work, I don't nkow why, here is
the statements that I had, could you check it and let me know what is
incorrect please.

[ud] is the name in the "Orders" Form
[combo1] is the name that I want to pull.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub OpenOrders_Click()
On Error GoTo Err_OpenOrders_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"
stLinkCriteria = "[ud]= & Me![Combo1]"


DoCmd.OpenForm stDocName, , stLinkCriteria



Exit_OpenOrders_Click:
Exit Sub

Err_OpenOrders_Click:
MsgBox Err.Description
Resume Exit_OpenOrders_Click

End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ofer said:
With the command line to open te second form you can send values using the
OpenArgs.
================================
docmd.OpenForm "FormName",,,,,,OpenArgs
So
Docmd.OpenForm "FormName",,,,,,Me.ComboName.Column(1)
The column number stand for the position of this column in the combo row
source, start with 0. So the 1 pass the name parameter
================================
In the second form you can always refer to this value that you passing as
Me.OpenArgs
================================
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
I have this question:

I have a form where the field is Combo1 and it has a source like this:

SELECT Users.UserID, [LastName] & " , " & [FirstName] AS Name,
Users.Password, Users.OrderPerson, Users.ApproverPerson,
Users.ReceiverPerson, Users.AdminPerson, Users.Active FROM Users WHERE
(((Users.Active)=Yes)) Or (((Users.Active)=Yes)) ORDER BY Users.Password;

this field only shows colum 2 where the data are:[LastName] & " , " &
[FirstName] AS Name (this form is mamed PASSWORD and I want to open another
form but I want that when I click the Icon of the "orders" form it pulls the
combo1 information, in the "orders"


anybody can help me?
I will apreciate so much, if you need more information please repy to this
group.
Ldiaz
 
G

Guest

Hi Ofer.
me again..
I'm using. your code, here is:

but when I try to open the form , it show me this error message " Sintax
error (comma) in query expresion '[ud]=Valencia , Francisco'. " and I don't
know why because I using the same source table.could you help me.
tell me if is necessary send to you my data Base.

Thanks..
for your answer.
ldiaz
______________________________________________________
Private Sub OpenOrders_Click()
On Error GoTo Err_OpenOrders_Click


Dim stDocName As String
Dim stLinkCriteria As String



stDocName = "Orders"
stLinkCriteria = "[ud]=" & Me![Combo1].Column(1)


DoCmd.OpenForm stDocName, , , stLinkCriteria





Exit_OpenOrders_Click:
Exit Sub

Err_OpenOrders_Click:
MsgBox Err.Description
Resume Exit_OpenOrders_Click

End Sub
___________________________________________________

Ofer said:
One more thing, the open form line should be

DoCmd.OpenForm stDocName, , ,stLinkCriteria
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
Hi Ofer,thank you for your help, but it does work, I don't nkow why, here is
the statements that I had, could you check it and let me know what is
incorrect please.

[ud] is the name in the "Orders" Form
[combo1] is the name that I want to pull.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub OpenOrders_Click()
On Error GoTo Err_OpenOrders_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"
stLinkCriteria = "[ud]= & Me![Combo1]"


DoCmd.OpenForm stDocName, , stLinkCriteria



Exit_OpenOrders_Click:
Exit Sub

Err_OpenOrders_Click:
MsgBox Err.Description
Resume Exit_OpenOrders_Click

End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ofer said:
With the command line to open te second form you can send values using the
OpenArgs.
================================
docmd.OpenForm "FormName",,,,,,OpenArgs
So
Docmd.OpenForm "FormName",,,,,,Me.ComboName.Column(1)
The column number stand for the position of this column in the combo row
source, start with 0. So the 1 pass the name parameter
================================
In the second form you can always refer to this value that you passing as
Me.OpenArgs
================================
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



:


I have this question:

I have a form where the field is Combo1 and it has a source like this:

SELECT Users.UserID, [LastName] & " , " & [FirstName] AS Name,
Users.Password, Users.OrderPerson, Users.ApproverPerson,
Users.ReceiverPerson, Users.AdminPerson, Users.Active FROM Users WHERE
(((Users.Active)=Yes)) Or (((Users.Active)=Yes)) ORDER BY Users.Password;

this field only shows colum 2 where the data are:[LastName] & " , " &
[FirstName] AS Name (this form is mamed PASSWORD and I want to open another
form but I want that when I click the Icon of the "orders" form it pulls the
combo1 information, in the "orders"


anybody can help me?
I will apreciate so much, if you need more information please repy to this
group.
Ldiaz
 
G

Guest

If the ud stand for UserID then use that
stLinkCriteria = "[ud]=" & Me![Combo1].Column(0)

If the ud stand for Name then use that
stLinkCriteria = "[ud]='" & Me![Combo1].Column(1) & "'"

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
Hi Ofer.
me again..
I'm using. your code, here is:

but when I try to open the form , it show me this error message " Sintax
error (comma) in query expresion '[ud]=Valencia , Francisco'. " and I don't
know why because I using the same source table.could you help me.
tell me if is necessary send to you my data Base.

Thanks..
for your answer.
ldiaz
______________________________________________________
Private Sub OpenOrders_Click()
On Error GoTo Err_OpenOrders_Click


Dim stDocName As String
Dim stLinkCriteria As String



stDocName = "Orders"
stLinkCriteria = "[ud]=" & Me![Combo1].Column(1)


DoCmd.OpenForm stDocName, , , stLinkCriteria





Exit_OpenOrders_Click:
Exit Sub

Err_OpenOrders_Click:
MsgBox Err.Description
Resume Exit_OpenOrders_Click

End Sub
___________________________________________________

Ofer said:
One more thing, the open form line should be

DoCmd.OpenForm stDocName, , ,stLinkCriteria
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



ldiaz said:
Hi Ofer,thank you for your help, but it does work, I don't nkow why, here is
the statements that I had, could you check it and let me know what is
incorrect please.

[ud] is the name in the "Orders" Form
[combo1] is the name that I want to pull.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub OpenOrders_Click()
On Error GoTo Err_OpenOrders_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"
stLinkCriteria = "[ud]= & Me![Combo1]"


DoCmd.OpenForm stDocName, , stLinkCriteria



Exit_OpenOrders_Click:
Exit Sub

Err_OpenOrders_Click:
MsgBox Err.Description
Resume Exit_OpenOrders_Click

End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:

With the command line to open te second form you can send values using the
OpenArgs.
================================
docmd.OpenForm "FormName",,,,,,OpenArgs
So
Docmd.OpenForm "FormName",,,,,,Me.ComboName.Column(1)
The column number stand for the position of this column in the combo row
source, start with 0. So the 1 pass the name parameter
================================
In the second form you can always refer to this value that you passing as
Me.OpenArgs
================================
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



:


I have this question:

I have a form where the field is Combo1 and it has a source like this:

SELECT Users.UserID, [LastName] & " , " & [FirstName] AS Name,
Users.Password, Users.OrderPerson, Users.ApproverPerson,
Users.ReceiverPerson, Users.AdminPerson, Users.Active FROM Users WHERE
(((Users.Active)=Yes)) Or (((Users.Active)=Yes)) ORDER BY Users.Password;

this field only shows colum 2 where the data are:[LastName] & " , " &
[FirstName] AS Name (this form is mamed PASSWORD and I want to open another
form but I want that when I click the Icon of the "orders" form it pulls the
combo1 information, in the "orders"


anybody can help me?
I will apreciate so much, if you need more information please repy to this
group.
Ldiaz
 

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