Results 1 to 13 of 13
  1. #1
    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.

  2. #2
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    970
    Submit to do what?
    10% of magic is knowing something that no-one else does. The rest is misdirection.

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

  4. #4
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    970
    So, you want to save a record?
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  5. #5
    Join Date
    Dec 2012
    Posts
    6
    Yes, i think i save the records in table.

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    970
    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.

  7. #7
    Join Date
    Dec 2012
    Posts
    6
    No, it was bound but i made it unbound..
    i want the button to submit the records.

  8. #8
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    970
    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.

  9. #9
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    12,436
    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 on the Tiger 800 or the Norton

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

  11. #11
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    970
    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
    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.

  13. #13
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    970
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •