As I look more carefully, there is. I copied and pasted your code which had
an extra argument, then added 1 more:
DoCmd.OpenForm stDocName, , , , acFormAdd, , acWindowNormal, Me.[Supplier
ID]
Should be:
DoCmd.OpenForm stDocName, , , , acFormAdd, acWindowNormal, Me.[Supplier ID]
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
"Steve Newport" <(E-Mail Removed)> wrote in message
news:43405F4C-8D29-4352-8DC1-(E-Mail Removed)...
> Thanks. Done that but I get a "Compile error" saying "Wrong number of
> arguments or invalid property assignment".
>
> I have entered both sets of codes as described.
>
> Any ideas?
>
> "Arvin Meyer [MVP]" wrote:
>
>> No the first line of code is in the button on the first form that opens
>> the
>> second one. The second form's Open event, needs to read the OpenOrgs
>> that's
>> passed from form number 1.
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>> "Steve Newport" <(E-Mail Removed)> wrote in message
>> news:90983ABE-5A93-4EC2-A510-(E-Mail Removed)...
>> > Many thanks for that - its miore like I expected to do but I am a bit
>> > confused by the second part. The first piece of code I entered using
>> > the
>> > DoCmd.Openform was in the event for the button to press to open the
>> > second
>> > form.
>> >
>> > When you say the second forms Open event - exactly where do you mean?
>> > Isn't
>> > it the same block of code?
>> >
>> > "Arvin Meyer [MVP]" wrote:
>> >
>> >> If you use the last argument, called OpenArgs in the OpenForm Method,
>> >> you
>> >> can get what you want.
>> >>
>> >> DoCmd.OpenForm stDocName, , , , acFormAdd, , acWindowNormal,
>> >> Me.[Supplier
>> >> ID]
>> >>
>> >> Now, in the second form's Open event use a line like:
>> >>
>> >> Me.txtSupplierID = Me.OpenArgs
>> >> --
>> >> Arvin Meyer, MCP, MVP
>> >> http://www.datastrat.com
>> >> http://www.mvps.org/access
>> >> http://www.accessmvp.com
>> >>
>> >> "Steve Newport" <(E-Mail Removed)> wrote in
>> >> message
>> >> news:6166E18C-1120-4627-A4DF-(E-Mail Removed)...
>> >> > Sorry basic question but I am going around in circles.
>> >> >
>> >> > I have a simple supplier table with Supplier ID as key. I open a new
>> >> > table
>> >> > with a form in preparation to add a new record in the second table
>> >> > (Contacts). Form opens OK and you can add entries but I want to copy
>> >> > across
>> >> > the Supplier ID so that it maintains the relationship. Tried several
>> >> > ways
>> >> > but
>> >> > cant manage it.
>> >> >
>> >> > The VB behind the relevant button that opens the form reads:
>> >> >
>> >> > Private Sub CMD_AddContact_Click()
>> >> > On Error GoTo Err_CMD_AddContact_Click
>> >> >
>> >> > Dim stDocName As String
>> >> > Dim stSupplierID As String
>> >> >
>> >> > stDocName = "FRM_ContactsAdd"
>> >> > stSupplierID = SupplierID
>> >> >
>> >> > DoCmd.OpenForm stDocName, , , , acFormAdd, , acWindowNormal
>> >> >
>> >> > Exit_CMD_AddContact_Click:
>> >> > Exit Sub
>> >> >
>> >> > Err_CMD_AddContact_Click:
>> >> > MsgBox Err.Description
>> >> > Resume Exit_CMD_AddContact_Click
>> >> >
>> >> > End Sub
>> >> >
>> >> > Which I have messed around with a bit. How should I be doing this?
>> >> >
>> >> > Many thanks
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>