PC Review


Reply
Thread Tools Rate Thread

CODE 2 ADD RECORD

 
 
Faraz Ahmed Qureshi
Guest
Posts: n/a
 
      5th Mar 2010
Could someone pls provide a sample code for BUTTON1 on FORM1 which onclick
adds the entries in TEXTBOX1, TEXTBOX2, TEXTBOX3, TEXTBOX4 to TABLE1's
FIELD1, FIELD2, FIELD3 & FIELD4?
--
Thanx & Best Regards,

Faraz!
 
Reply With Quote
 
 
 
 
Faraz Ahmed Qureshi
Guest
Posts: n/a
 
      5th Mar 2010
John Vinson's

Private Sub BUTTON1_Click()
Dim strSQL As String
On Error GoTo Proc_Err
strSQL = "INSERT INTO mytablename (FIELD1, FIELD2, FIELD3, FIELD4) " _
& "VALUES(""" & Me!TEXTBOX1 & """, """ & Me!TEXTBOX2 & _
""", """ & Me!TEXTBOX3 & """, """ & Me!TEXTBOX4 & """);"
Currentdb.Execute strSQL, dbFailOnError
Proc_Exit:
Exit Sub
Proc_Err:
MsgBox "Error " & Err.Number & " in BUTTON1_Click" & vbCrLf & Err.Description
Resume Proc_Exit
End Sub

DID IT!!!

--
Thanx & Best Regards,

Faraz!


"Faraz Ahmed Qureshi" wrote:

> Could someone pls provide a sample code for BUTTON1 on FORM1 which onclick
> adds the entries in TEXTBOX1, TEXTBOX2, TEXTBOX3, TEXTBOX4 to TABLE1's
> FIELD1, FIELD2, FIELD3 & FIELD4?
> --
> Thanx & Best Regards,
>
> Faraz!

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
code to open blank form activates code to show record has changed Repent Microsoft Access Forms 2 20th May 2009 05:24 PM
Code writes to subsequent record instead of current record =?Utf-8?B?TWVtZW50bw==?= Microsoft Access VBA Modules 3 27th Aug 2007 09:01 AM
error code 2147467259 and Code SQL 3047 - record is to long =?Utf-8?B?VmVyeXN0dW1wZWQ=?= Microsoft Access VBA Modules 1 4th Jan 2006 03:20 AM
Form code: how do I run code every time a record is "loaded" by going to next record, last record, etc. Dave R. Microsoft Access Macros 1 24th Jun 2005 07:37 PM
Code to go to a record in pop up form based on record in active fo =?Utf-8?B?a2V2aW4=?= Microsoft Access Getting Started 2 28th Apr 2005 04:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:07 PM.