Emulating Split Form Example (1 Viewer)

JamesJoey

Registered User.
Local time
Today, 16:03
Joined
Dec 6, 2010
Messages
570
I downloaded the Split Form emulator (EmulateSplitForm v3accdb.)
It work fine but I had to change something and was wondering about this for some time.
It's about whether to use a '.' or a '!'
When I first pasted the code in from the On Load event and replaced the object names with mine,
I got an error when debugging.
Below is my code:


Dim strSQL As String

strSQL = "SELECT tblContacts.* FROM tblContacts ORDER BY Listing;"

Me.RecordSource = strSQL 'set the recordsource of the main form
Me!frmContactsSub.SourceObject = "frmContactsSub" 'load datasheet subform w/ blank RecordSource
Set Me!frmContactsSub.Form.Recordset = Me.Recordset 'set subform recordset to same object as main form's



The first time I debugged it highlight 'frmContacts' saying Data member not found, When I changed the '.' to '!' It was fine.
I opened the original On Load and debugged but didn't get an error.

Why didn't I get the same error I got in my code??

Original code:

'This is the main form open event handler

Dim strSQL As String

strSQL = "SELECT ArchivedClasses.* FROM ArchivedClasses;"
Me.RecordSource = strSQL 'set the recordsource of the main form
Me.fsubArchivedClasses.SourceObject = "fsubArchivedClasses" 'load datasheet subform w/ blank RecordSource
Set Me.fsubArchivedClasses.Form.Recordset = Me.Recordset 'set subform recordset to same object as main form's

 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:03
Joined
Oct 29, 2018
Messages
16,156
Oh boy! That's actually a very old topic with lots of discussions going back and forth on the subject of "bang vs dot. "

If you do a search on those terms, you might find some of those old discussions.
 

isladogs

CID VIP
Local time
Today, 21:03
Joined
Jan 14, 2017
Messages
15,267
I'm not going to get into the dot vs bang argument as its already been beaten to death and back again many times.
I always use dot after Me ...not least because I get the benefits of intellisense.

Just to check are you using the name of the subform control in the main form. It may not be the same as the subform object.
 

Users who are viewing this thread

Top Bottom