Input Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have posted several questions about this, but I think I am finaly close...
Now I am trying to link two tables, I want the program to search one table
for the user selected criteria, take all of the data in another collumn that
matches that search, and search anouther table to bring up all forms with
that information, as of right now the code will start running then ask the
user for input again, using one of the matching words from the collumn that
it is getting new data from then when data is entered there it opens all of
the forms regardless of what you put in there.

Here is the code:

Private Sub Additive_Click()

Dim stLinkCriteria As String
Dim stLinkCriteria1 As String

stLinkCriteria = "ADNAM!ADNAM = '" & Me!Additive.Value & "'"
stLinkCriteria1 = DLookup("[PRONAM]", "ADNAM", stLinkCriteria)
DoCmd.OpenForm "tblPropellant Query", , , stLinkCriteria1

End Sub

If someone could help with this that would be great,
Thanks,
James
 
Hi James

It looks like you have two related tables - Propellants and Additives - with
a one-to-many relationship linking the ADNAM fields in the two tables.

In this case, you should base your form on a query which includes both the
tables, with a join between those two fields. Then your form can show all
the Propellants which use Additives with a particular characteristic, or
vice-versa.
 
Thanks that soved the problem
-James

Graham Mandeno said:
Hi James

It looks like you have two related tables - Propellants and Additives - with
a one-to-many relationship linking the ADNAM fields in the two tables.

In this case, you should base your form on a query which includes both the
tables, with a join between those two fields. Then your form can show all
the Propellants which use Additives with a particular characteristic, or
vice-versa.

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

James said:
Hi,

I have posted several questions about this, but I think I am finaly
close...
Now I am trying to link two tables, I want the program to search one table
for the user selected criteria, take all of the data in another collumn
that
matches that search, and search anouther table to bring up all forms with
that information, as of right now the code will start running then ask the
user for input again, using one of the matching words from the collumn
that
it is getting new data from then when data is entered there it opens all
of
the forms regardless of what you put in there.

Here is the code:

Private Sub Additive_Click()

Dim stLinkCriteria As String
Dim stLinkCriteria1 As String

stLinkCriteria = "ADNAM!ADNAM = '" & Me!Additive.Value & "'"
stLinkCriteria1 = DLookup("[PRONAM]", "ADNAM", stLinkCriteria)
DoCmd.OpenForm "tblPropellant Query", , , stLinkCriteria1

End Sub

If someone could help with this that would be great,
Thanks,
James
 
Back
Top