Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How do I make a form save the data entered by user in the form?

Posted on 2011-03-01
3
228 Views
Last Modified: 2012-05-11
Hi,

I have a dialogue box with 4 combo boxes that allow the user to enter dates.

these dates are then used to update a table in the database to be used in several queries.

The update works fine but my only issue is once the user as finished that step of updating the dialogue box they move on to other steps. But if a user thinks, 'hang on did I really enter the correct dates?" I want them to be able to go back to the form .... (A command button opens the form)...and on opening it I want the user to see the dates they have entered in the session without necessarily digging through the database for the table that has been updated?

i'm pretty sure thi is a simple task.

I've attached the code i am using for the dialogue box. Is there something i need to code for the form itself hat holds the dialogue box?


Option Compare Database

Private Sub CmdCancel_Click()

DoCmd.Close acForm, "Update_Valdate"

...........................................................
End Sub

Private Sub CmdOK_Click()

DoCmd.SetWarnings False


If IsNull(cbovaldate) Or IsNull(cboNZRG0date) Or IsNull(cboNBDate) Or IsNull(cboBOYStart) Then
    MsgBox "Valuation dates may not be blank!", vbExclamation + vbOKOnly
    Exit Sub
    End If

   

DoCmd.RunSQL "Update zzvaldate set zzvaldate.Valuation_Date = #" & Forms!Update_Valdate!cbovaldate & "# ; "

DoCmd.RunSQL "Update zzvaldate set zzvaldate.Valuation_Date_yyyymmdd = " & Forms!Update_Valdate!cboNZRG0date & " ; "

DoCmd.RunSQL "Update zzvaldate set zzvaldate.NB_start_date =# " & Forms!Update_Valdate!cboNBDate & " #; "

DoCmd.RunSQL "Update zzvaldate set zzvaldate.BOY_Date =#" & Forms!Update_Valdate!cboBOYDate & " # ; "


MsgBox "Valuation dates have been updated", vbOKOnly

DoCmd.Close acForm, "Update_Valdate"

DoCmd.SetWarnings True


End Sub

Open in new window

0
Comment
Question by:DB_newbie_NZ
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 125 total points
ID: 35012660
Why don't you just Bind your form to the zzvaldate table, and then bind the controls to the relevant fields? This would take care of those things automatically for you.
0
 

Author Comment

by:DB_newbie_NZ
ID: 35013034
Hi LSM, If i bind the form to the zzvaldate table is that not circular? - ie the form is bound to zzvaldate but zzvaldate is updated by data in the form.

zzvaldate can only be updated by the user entering dta in the form.

perhaps I'm getting this all wrong - will try the bound idea.
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 125 total points
ID: 35018986

<No Points wanted>

<If i bind the form to the zzvaldate table is that not circular? - ie the form is bound to zzvaldate but zzvaldate is updated by data in the form. >
Well this is not really referred to as being "circular" (Circular would be a table bound to itself, or a form bound to itself, which is impossible...)
Think of the form as a Pretty face put on the table.
;-)

What LSM suggested is known as a "Bound" form.
It is the way most forms are designed, unless you really need the full control that an "Unbound" form affords...
...And really want to keep track of controlling SQL queries, Recordsets, Events...etc...

I'll let you continue on with LSM...
;-)

JeffCoachman
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question