HELP! I have FORM SQL/VBA questions

G

Guest

Hi -

I have a form:

My heading contains 1 list box field called ASSY1. It is unbound and gets
it's data from the PSF_TABLE.

My detail has the following fields:
ASSY, PART, VDESC, UM, BOM_ID, REF, QPA, PROJECT, COMMENTS, RELEASED

They come from the ps_table and the im_table. I set these up to be actual
fields not unbound.

On the ASSY1 field, I have placed the following a code on the AFTER_UPDATE
event. I had wanted to attach it to a command button, but could not find one
which would work.

Private Sub ASSY1_AfterUpdate()
If Len(assy1) > 0 Then
cSQL = "SELECT PSF_TABLE.ASSY, PSF_TABLE.PART, IM_TABLE.VDESC,
IM_TABLE.UM,"
cSQL = cSQL & "PSF_TABLE.BOM_ID, PSF_TABLE.REF, PSF_TABLE.QPA,
PSF_TABLE.PROJECT, "
cSQL = cSQL & "PSF_TABLE.COMMENTS, PSF_TABLE.RELEASED "
cSQL = cSQL & "FROM PSF_TABLE, IM_TABLE "
cSQL = cSQL & "WHERE PSF_TABLE = '" & Me!assy1 & "'"
cSQL = cSQL & " AND PSF_TABLE.PART = IM_TABLE.PART "
cSQL = cSQL & "ORDER BY PSF_TABLE.PART"
End If

Me.AllowAdditions = False

Me.RecordSource = cSQL

Debug.Print cSQL
End Sub

When I enter the form I am asked to enter a parameter value for
im_table.VDESC, im_table.UM, Me!Assy, im_table.PART. Using the drop down, I
select a value into ASSY1 and am asked to enter a parameter for PSF_TABLE.
Nothing happens and I do not get any fields. Also the debugger does not come
up (not sure how to turn it on).

So now I am a bit lost.
* Am I using the correct method to produce a query screen where the user
would enter a value in a unbound field and display those items which are
equal to it?
* Why am I being requested to enter values in the beginning of the form?


Any help/direction you can offer is appriciated.
 
G

Guest

A quick update from me:

* I got rid of all of the popups, my SQL statement was incorrect where I
stated "WHERE PSF_TABLE = '" &Me!assy1 & "'" it was suppose to be "WHERE
PSF_TABLE.ASSY = '" &Me!assy1.

* I did figure out the debugger. Yeah! However all tricks and tips are
appricated.

However I am still having problems getting the query results to display.
After my select nothing happens. How do I get multiple rows (heck even one
row) to display?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top