DoCmd.GotoRecord; How to pass variables?

T

Tim Fierro

Hello, I need help on the DoCmd.GotoRecord function.

I have the following forms that are used to make purchases.

v2 - PMS Purchase Orders - Main Form
v2 - PMS Purchase Orders - Subform

One of the fields in the SUBFORM (OrdInt), is displayed in a text box when
making item selections. As well as pricing and descriptions, the OrdInt
field is so I know what our Internal part number is when working with other
forms.

Yesterday I changed this field in the Form so it is a hyperlink. I then
added this code in that field's (OrdInt) OnClick event;

Private Sub OrdInt_Click()
DoCmd.OpenForm "New Item Entry Form (ITEM)"
End Sub

This then opens up another form where I keep the individual information for
every part in our system. This includes every vendor's item number, price,
date last checked, etc.... The code above will open that Form and that is
better then opening the form manually and advancing to the record I am
after. However, the next step is to have the form automatically advance to
the part number we want to work with.

The field that I need to match in the Item List is;

ItemId

So basically when using this from, the PO Form;

Private Sub OrdInt_Click()
DoCmd.OpenForm "New Item Entry Form (ITEM)"
End Sub

I want to pass what OrdInt has in it so that it brings up the corresponding
record in the items form with the field of ItemId. I am just not sure how
to pass the variable from one form to the next.

Example would be that in the PO System Form I may have an OrdInt displayed
as "B-WOO-019", and when it pulls up the Item Form it should advance to the
record holding "B-WOO-019" as it's ItemId field.

Anyone care to help with the code or point me into the right direction to
utilize the DoCmd.GotoRecord function? Most everything I am finding is
discussing the AddNewRecord type of argument to the list of variables it can
accept, but I don't need that one.

Hopefully I explained it correctly. :)

Tim







--



Tim Fierro - Parts Manager
Howard Moe Enterprises, Inc.
Ph: 360-538-1622 / Fax: 360-538-0225
e-Mail: (e-mail address removed)
 
S

Svetlana

Dim strCriteria As String
strCriteria = "[ItemId]=" & Me![OrdInt]
DoCmd.OpenForm "New Item Entry Form (ITEM)", , , strCriteria
 

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

Top