Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i get value from a form in ADP file.

Status
Not open for further replies.

asafb

Programmer
Jun 17, 2003
80
US
hello, i have a function which is suppose to query based on a text box in a form like this:

SELECT * from table where salespersonid = @forms_form1_text0

but it doesn't work!!! the form *is* open and I enter a number and it pops up 'parameter value', then says "forms_form1_text0", like I have to enter it manually as if it doesn't see the form

what is wrong???
help!
thanks
asaf
 
i couldn't find a way to do that either. before in the mdb i was passing a parameter from the form to the query to the run a report from that query. now in the adp, i enter my text on the form, click a command button to run the report then in the code for the report open i use the following code to set the record source and fill in the query parameters:

Private Sub Report_Open(Cancel As Integer)
Dim strRecordSource As String
strRecordSource = "Exec QueryName '" & Forms!frmName![objectname] & "'"
Me.RecordSource = strRecordSource
End Sub
 
I don't know exactly what you are doing but the way that always works for me is to pass the variable from a function.

In the Standard Module.
public myvar as string

Public Function Returnmyvar() as string
Returnmyvar = myvar
End Function

In the Form.
'- chr(39) is single quote.

dim sqlstr as string
myvar = @forms_form1_text0
sqlstr = SELECT * from table where salespersonid = " & chr(39) & Returnmyvar() & chr(39)

Me.RecordSource = sqlstr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top