Macros Opening Linked Forms? (1 Viewer)

Dumbfounded

Registered User.
Local time
Today, 09:41
Joined
Jul 26, 2007
Messages
92
Hi Guys,

It's been a while but I have moved back into a job where they have requested databases and I'm a little out of practice.

It is a relatively simple database, a survey no less. I have broken the survey down into sections and placed these onto a tabbed sheet. Now, knowing staff as I do, I don't want any of the tabs skipping so I have put navigation buttons on the bottom of each survey section so it can take them to the next sheet and previous sheet. I have done this with macros.

However, thinking that was a mark of sheer genius on my part (der), I now realise that it actually isn't opening the linked sheet to my master sheet. I have set the macro to open the sub sheet but I need it to open the linked sheet so that the information is saved - is there a way. Any help would be greatly appreciated.

TIA

Donna
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:41
Joined
Oct 29, 2018
Messages
21,454
Hi. Can you post some screenshots? I am not sure what you're referring to as "sheets."
 

Dumbfounded

Registered User.
Local time
Today, 09:41
Joined
Jul 26, 2007
Messages
92
Sorry, a tabbed control - the forms/sub forms sit here and then the navigation buttons open the next form for them to complete, but these aren't linked to the master form. I would upload it but it's asking for a URL and not the option for uploading from my pc.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:41
Joined
Oct 29, 2018
Messages
21,454
Okay, how about posting the code behind your macros?
 

Dumbfounded

Registered User.
Local time
Today, 09:41
Joined
Jul 26, 2007
Messages
92
RunMenuCommand
Command Save Record
OpenForm
Form Name Frm_Survey 9-12
View Form
Filter Name
Where Condition
Data Mode Add
Window Mode Normal

I have to say that I am finding V16 quite user unfriendly.
 

Dumbfounded

Registered User.
Local time
Today, 09:41
Joined
Jul 26, 2007
Messages
92
This is the VBA when I converted it - I can't see any other way of viewing the code - it's so frustrating.

Option Compare Database

'------------------------------------------------------------
' VBA_Open_9_12
'
'------------------------------------------------------------
Function VBA_Open_9_12()
On Error GoTo VBA_Open_9_12_Err

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "Frm_Survey 9-12", acNormal, "", "", acAdd, acNormal


VBA_Open_9_12_Exit:
Exit Function

VBA_Open_9_12_Err:
MsgBox Error$
Resume VBA_Open_9_12_Exit

End Function
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:41
Joined
May 21, 2018
Messages
8,525
Not sure if that will cause you a problem, but do not use "" for default information. Leave it blank.

DoCmd.OpenForm "Frm_Survey 9-12", acNormal, "", "", acAdd, acNormal
DoCmd.OpenForm "Frm_Survey 9-12", acNormal, , , acAdd, acNormal
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:41
Joined
Oct 29, 2018
Messages
21,454
Okay, thanks. I see you're opening up a form. Is this what you mean? You wanted the form you're opening to show up in the tab? Is it showing up on top of the first form?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:41
Joined
May 21, 2018
Messages
8,525
Also that is not correct. The acNormal on the end is AcWindowNormal and can be dropped since it is default along with acnormal since it is default.
 

isladogs

MVP / VIP
Local time
Today, 17:41
Joined
Jan 14, 2017
Messages
18,209
The syntax should actually be
DoCmd.OpenForm "FormName", , , , acFormAdd
 

Dumbfounded

Registered User.
Local time
Today, 09:41
Joined
Jul 26, 2007
Messages
92
Thanks ever so much - I will have a play and see what becomes of it :)
 

Users who are viewing this thread

Top Bottom