If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > How to submit transaction through submit button

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 6
How to submit transaction through submit button

Hi All,

Please provide me the coding for submit button for all the field in table thru form. There are 12 fields, some of have number, memo, text and date format.

how to attached the file for more details.
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 959
Submit to do what?
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 6
Thanks to reponse Weejas,
Actually i want to submit the transaction which we do on the daily basis...
like policy nuumber
done date
comments
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 959
So, you want to save a record?
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 6
Yes, i think i save the records in table.
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 959
Well, if your form is bound to the table, it will happen automatically.
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 6
No, it was bound but i made it unbound..
i want the button to submit the records.
Reply With Quote
  #8 (permalink)  
Old
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 959
In that case, you will need to compose an SQL statement to insert a new record into the source table, and populate that statement using the values contained in the form:
Code:
Dim strSQL As String

strSQL = "INSERT INTO Table (TextField1, TextField2, NumericField1, DateField1, NumericField2, TextField3) "
strSQL = strSQL & "VALUES ('" & TextControl1 & "', '" & TextControl2 " & "', "
strSQL = strSQL & NumericControl1 & ", #" & Format(DateControl1, "yyyy-mm-dd") & "#, "
strSQL = strSQL & NumericControl2 & ", '" & TextControl3 & "')"
CurrentDB.Execute strSQL
You will also need code to clear the values from the form once they have been written to the database.

If you are using the same form to display existing records as well as entering new ones, you will need to account for that and compile an update statement as well.
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
  #9 (permalink)  
Old
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 11,663
TRANSACTION Statement (Microsoft Access SQL)*[Access 2007 Developer Reference]

build your SQL statements
start a transaction
run a SQL statement
perform what ever checks are required
run as many more SQL statements you need (and check the results)
then if the results are OK COMMIT the transaction
or if results have failed ROLLBack the transaction

I forget when TRANSACTION was supported in JET, according to the link above from 2007 at the latest
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #10 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 6
Hi Weejas,

Me new in the access so not able to understand the sql statement which you have provided me. So please could you me provide the coding according my table fields. fields are same in form and table.

Name of form and table fields with date types.


Policy_No Memo
Region Text
WorkType Text
Transacton_Date Date
Status Text
Question_Date Date
Answered_Date Date
Create_worktype Text
Done_BY Text
Comments Memo

Please one more thing that how to assign this code to button as code builder, Expression builder or macro builder.

If you need more details please give me you mail id so i can send you the attachment.
Reply With Quote
  #11 (permalink)  
Old
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 959
Let's back up a step. What is your level of knowledge regarding VBA? My sample code covers the main data types and how to delimit them for Jet SQL, but if you can't follow it then we might need to take things back a bit.
Also, you will learn more from having a go and trying to construct the SQL string yourself than if someone just hands it to you on a plate. The people on this forum are generally nice and kind, but are more geared to helping those who want to help themselves.
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
  #12 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 6
Weejas,,,
Very Thank you to let me know that i can help myself first.. so could you let me know that is there any book or link through i can understand the VBA and SQL in simple and easy manner.

I am not good in VBA.
You can say that its my starting to learn the Access, Excel, VBA and SQL.
Reply With Quote
  #13 (permalink)  
Old
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 959
I've found that the "...For Dummies" books are a good starting point - they introduce concepts and lead the reader through them step-by-step.
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On