| |
|
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.
|
 |

12-10-12, 09:01
|
|
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.
|
|

12-10-12, 09:37
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 834
|
|
|
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
|
|

12-10-12, 09:40
|
|
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
|
|

12-10-12, 09:44
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 834
|
|
So, you want to save a record?
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
|
|

12-10-12, 09:48
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 6
|
|
Yes, i think i save the records in table.
|
|

12-10-12, 10:13
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 834
|
|
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.
|
|

12-10-12, 10:35
|
|
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.
|
|

12-10-12, 11:09
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 834
|
|
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.
|
|

12-10-12, 11:11
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 10,508
|
|
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
|
|

12-12-12, 03:13
|
|
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.
|
|

12-12-12, 03:58
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 834
|
|
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.
|
|

12-12-12, 16:16
|
|
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.
|
|

12-13-12, 04:40
|
|
Registered User
|
|
Join Date: Sep 2006
Location: Surrey, UK
Posts: 834
|
|
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.
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|