From: RedHeadedMonster via AccessMonster.com on
I have a login form that will login who is using the database and the date.
It has the following code connected to the onClick event of an OK button:

Dim rosterSQL As String

Set rosterSQL = "Insert into tblLOGIN([rosterID], [loginDate]) Values ('" &
Me.rosterID & "', Now() );"
DoCmd.SetWarnings (0)
DoCmd.RunSQL rosterSQL

please note the tick marks vs. quotes around rosterID: ' " & Me.RosterID &
" '

The form has rosterID as a field. But when I run the code I get a "Compile
error Object required" and the following is highlighted in the code: .
RosterID

Any idea what my hickup is?
Thanx!
RHM

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1

From: Mike Painter on
RedHeadedMonster via AccessMonster.com wrote:
> I have a login form that will login who is using the database and the
> date. It has the following code connected to the onClick event of an
> OK button:
>
> Dim rosterSQL As String
>
> Set rosterSQL = "Insert into tblLOGIN([rosterID], [loginDate]) Values
> ('" & Me.rosterID & "', Now() );"
> DoCmd.SetWarnings (0)
> DoCmd.RunSQL rosterSQL
>

run msgbox rosterSQL
I suspect you will see ' & Me.rosterID &

"Insert into tblLOGIN([rosterID], [loginDate]) Values '" & Me.rosterID &
"', Now() );"


From: Maurice on
Have you tried switching the single apostrophes in front of the double quotes
like:

"' & Me.RosterID & '"

But then again if your id is a numeric value you should try it without the
quotes and double quotes by just placing me.rosterid.

i'd say give it a try..

--
Maurice Ausum


"RedHeadedMonster via AccessMonster.com" wrote:

> I have a login form that will login who is using the database and the date.
> It has the following code connected to the onClick event of an OK button:
>
> Dim rosterSQL As String
>
> Set rosterSQL = "Insert into tblLOGIN([rosterID], [loginDate]) Values ('" &
> Me.rosterID & "', Now() );"
> DoCmd.SetWarnings (0)
> DoCmd.RunSQL rosterSQL
>
> please note the tick marks vs. quotes around rosterID: ' " & Me.RosterID &
> " '
>
> The form has rosterID as a field. But when I run the code I get a "Compile
> error Object required" and the following is highlighted in the code: .
> RosterID
>
> Any idea what my hickup is?
> Thanx!
> RHM
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1
>
> .
>
From: RedHeadedMonster via AccessMonster.com on
Im afraid Im not understanding what you are saying.

Mike Painter wrote:
>> I have a login form that will login who is using the database and the
>> date. It has the following code connected to the onClick event of an
>[quoted text clipped - 6 lines]
>> DoCmd.SetWarnings (0)
>> DoCmd.RunSQL rosterSQL
>
>run msgbox rosterSQL
>I suspect you will see ' & Me.rosterID &
>
> "Insert into tblLOGIN([rosterID], [loginDate]) Values '" & Me.rosterID &
>"', Now() );"

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1

From: RedHeadedMonster via AccessMonster.com on
When I do this I get the same error...except this time is highlights
rosterSQL

Maurice wrote:
>Have you tried switching the single apostrophes in front of the double quotes
>like:
>
>"' & Me.RosterID & '"
>
>But then again if your id is a numeric value you should try it without the
>quotes and double quotes by just placing me.rosterid.
>
>i'd say give it a try..
>
>> I have a login form that will login who is using the database and the date.
>> It has the following code connected to the onClick event of an OK button:
>[quoted text clipped - 16 lines]
>> Thanx!
>> RHM

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1