Solved

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

Posted on 2011-03-01
3
230 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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