Arvin,
Thank you for such a quick response! I did change the name of the text box
but I got a different error. It is from the statement:
Me.NameOfSubform.Recordsource = strSQL
With the syntax you gave me, it looks like code that would run on the main
form. I need the code to run from within the subform Vehicle and based on
the current row there, requery another subform on this screen called Vehicle
Allocation History. The main form is unbound. (I'm sure this late hour
isn't helping either of us!)
Do you see what I mean? Thanks,
Debbie
"Arvin Meyer [MVP]" wrote:
> Dim strSQL As String
> strSQL = "SELECT * FROM Vehicle WHERE VIN = '" & txtVIN & "'"
> Me.NameOfSubform.Recordsource = strSQL
>
> You may have a problem with ambiguous naming of VIN, so it would be wise to
> name the textbox txtVIN.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Debbie" <(E-Mail Removed)> wrote in message
> news:92846A60-907F-4768-8D9A-(E-Mail Removed)...
> > Hello all,
> > I know there are many appends on this but I just can't get this to work.
> >
> > I have an unbound main form (Main). On it are several subforms. The
> > first
> > subform (Vehicle) contains a summary of the vehicles. When I click on one
> > of
> > the vehicles, I would like the second subform (Vehicle Allocation History)
> > to
> > display records for the vehicle selected in the Vehicle form. Below is my
> > code:
> >
> > Dim VehAlloc As Control
> > Dim Main As Form
> > Dim VIN As String
> > Dim SQL As String
> >
> > Set Main = Forms("VehicleSummaryForm")
> > Set VehAlloc = Main.VehicleAllocationHistory
> > VIN = Me!VIN
> > SQL = "SELECT * FROM Vehicle WHERE VIN = '" & VIN & "'"
> > VehAlloc.Form.RecordSource = SQL
> >
> > I keep getting an error saying that I'm making an invalid reference. I
> > have
> > tried the Parent property, fully qualifying form names and other stuff
> > which
> > is now all a blur. I also tried the statement VehAlloc.Recordsource = SQL
> > but that didn't work. Does any one have any idea as to why this won't
> > work?
> > Any suggestions would be most appreciated. Thanks in advance.
> > Debbie
>
>
>