Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Next record using subforms

Status
Not open for further replies.

dynamictiger

Technical User
Dec 14, 2001
206
AU
I have a form with two subforms that are seperate but linked by the main form which has a linking field.

I now want to add a third subform to navigate and add new as required.

To try and make this clear:

Main Form - SubForm1 - Link - SubForm2

SubNavigate - updates - Subform1 - Updates - Link - Updates - Subform2

I am having a bit of fun with the naviagation from the SubNavigate form.

This form has three buttons. Next Back and Add.

At the moment I am just looking at the Next as I think if I can get this operating the others will be simple.

I have code like:

Dim strForm As String

strForm = CStr(Me.Parent("ChemMsg").Form)

MsgBox Me.Parent("ChemMsg").Form("cboMessage")

DoCmd.GoToRecord , strForm, acNext

MsgBox Forms("frmChemName")("tblMessages")("ChemMsg").Form("cboMessage")

However, it appears the syntax ("ChemMsg") is causing a problem. I think this requires single double quotes approach, but I have not yet been able to sort this out.

Anyone got this solved?
 
strForm = Me.Parent("ChemMsg").Form.name

might work (assuming this is the line containing "ChemMsg" with which the error is associated)

some useful constructs you could use in your code could be:

Dim MyMainForm as Forms_MainForm
set MyMainForm = me.parent
strForm = MyMainForm.name

msgbox MyMainForm.cboMessage
 
Thanks I tried that previously. That string returns the name of the subform which access detects as not being open.

I am pretty sure I need to pass in

Forms!name of parent!name of sub

as a string, but so far haven't been able to work it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top