Re: Insert statement not updating table?
- From: "Pamela via AccessMonster.com" <forum@xxxxxxxxxxxxxxxxx>
- Date: Fri, 12 Aug 2005 18:51:09 GMT
Thanks. I didn't know you could do it that way too. I'm used to entering
straight SQL statements and not using them in VBA code...I had realized my
statement was incorrect when msgbox kindly displayed the SQL statement being
executed for me. Just started learning VB & I really appreciate the quality
help I get from this forum. :)
Rick Brandt wrote:
>> Hello,
>>
>[quoted text clipped - 11 lines]
>> another table, with RecID being the related field. Any thoughts?
>> MsgBox [Num] is returning the correct value...
>
>In VBA code in your form's module [Num] means something. It refers to the
>control or field on the form with the name "Num". In a SQL String it is
>just 5 characters being passed to the Jet database engine and Jet does not
>know anything about your form at the time of execution. (You should be
>getting an error or a parameter prompt).
>
>You need to delimit the string so that the string ends up with the values
>contained in [Num] and [ContactDate] instead of the reference to them (since
>Jet cannot evaluate that reference).
>
>SQL1 = "INSERT INTO tblContactDateHistory ( RecID, ContactDate) " & _
> "Values ( " & Me![Num] & ", #" & Me![ContactDate] & "#)"
>DoCmd.RunSQL SQL1
>
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200508/1
.
- References:
- Insert statement not updating table?
- From: Pamela via AccessMonster.com
- Re: Insert statement not updating table?
- From: Rick Brandt
- Insert statement not updating table?
- Prev by Date: Re: Add a field to a linked table
- Next by Date: Re: Textbox Control
- Previous by thread: Re: Insert statement not updating table?
- Next by thread: Basis Question
- Index(es):
Relevant Pages
|
Loading