From: RedHeadedMonster via AccessMonster.com on 4 Mar 2010 13:42 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 4 Mar 2010 14:46 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 4 Mar 2010 14:57 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 4 Mar 2010 15:05 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 4 Mar 2010 15:23 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
|
Next
|
Last
Pages: 1 2 Prev: Hyperlinks to pdfs and word documents are not working Next: Object dependencies in Access 2007 |