I have a wonderful piece of SQL which does exactly what I want it to:
Dim sqlstr As String
sqlstr = "SELECT * FROM FromLegal LEFT JOIN FromCDG ON [FromLegal].[IDNumber]= [FromCDG].[IDNumber]" & _
" WHERE FromLegal.CounterpartyName Like """ & "*" & Me.CPNAME & "*" & """;"
DoCmd.RunSQL (sqlstr)
Except ... I run this from a button on a form. The idea is to pull back all of the records that meet the criteria in a textbox (Me.CPNAME). However, when I try to run this, I get an error asking me to do something with the result of this SQL, i.e. create a table, add it to a table etc. I want the data to appear just as a temporary and updatable set of records, because the user would use this code to lookup records by counterparty name and update them. That update would need to be saved back into the two tables queried (FromLegal, FromCDG). This is my first real adventure in Access, so be very detailed please.
Thanks ahead of time.
Dim sqlstr As String
sqlstr = "SELECT * FROM FromLegal LEFT JOIN FromCDG ON [FromLegal].[IDNumber]= [FromCDG].[IDNumber]" & _
" WHERE FromLegal.CounterpartyName Like """ & "*" & Me.CPNAME & "*" & """;"
DoCmd.RunSQL (sqlstr)
Except ... I run this from a button on a form. The idea is to pull back all of the records that meet the criteria in a textbox (Me.CPNAME). However, when I try to run this, I get an error asking me to do something with the result of this SQL, i.e. create a table, add it to a table etc. I want the data to appear just as a temporary and updatable set of records, because the user would use this code to lookup records by counterparty name and update them. That update would need to be saved back into the two tables queried (FromLegal, FromCDG). This is my first real adventure in Access, so be very detailed please.
Thanks ahead of time.