Help: Recordset values and SQL queries 
Author Message
 Help: Recordset values and SQL queries

Yes, there is a better way. You can create "get" property procedures in a
form and fetch data in form2 from form1 like this:

In form1:

Public Property Get YourName() as String
    YourName = "Eric"
End Property

In Form2:

    dim sName as String

    sName = form1.YourName

Change the procedure names, variables, and data types to suit your
situation. You don't need (and never did need) the hidden text box.

Eric


Quote:
> I have a Jet database with two tables, Tasking and TaskUpdates

> In the Tasking table there is an autonumber field "TaskID", no
> duplicates.

> In the TaskUpdates there is a long integer field "TaskID", duplicates
> allowed.

> The "TaskID" in TaskUpdates refer to the "TaskID" in Tasking - there
> may be many updates to only one task.

> When the Task Updates form is launched, I want the grid to show only
> those updates where Tasking.TaskID = TaskUpdates.TaskID; however
> sending the TaskID from one form to another has been problematic.

> What I coded was:

> 1. From the main form, when the Task Updates form is launched, I send
> the TaskID field to a hidden text box on the Task Updates form

> frmTaskUpdate!TaskRSValue.Text =
> datTaskingmdb.Recordset.Fields("TaskID")

> 2. The from the newly launched Task Updates form, I set the SQL query
> Tasking.TaskID = TaskUpdates.TaskID

> Private Sub GridValues()
> Dim iRSValue As Integer, sGridSQL As String

>    iRSValue = TaskRSValue.Text
>     sGridSQL = "SELECT * FROM [TaskUpdates] WHERE [TaskID] =" & "
> " & iRSValue
>     GridTaskUpdates.RecordSource = sGridSQL
>     GridTaskUpdates.Rebind True

> Is there a better way to do this?



Sat, 15 Jun 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. NULL Values in SQL Queries - HELP HELP

2. NULL Values in SQL Queries - HELP!

3. Use Parameter Queries in VBA- Then open as Recordset- collect values

4. Dynamically changing the SQL value in a query

5. Rounding values in SQL query

6. International SQL queries and boolean values

7. SQL - Query to get a maximum value

8. SQL query selecting null values

9. Getting the value of a Sum() in a SQL query

10. SQL - sorting one recordset by another's values

11. Use query sql code in recordsets

12. SQL queries or DAO recordset?

 

 
Powered by phpBB® Forum Software