Solved

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

Posted on 2011-03-01
3
234 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
[X]
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
3 Comments
 
LVL 85

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

626 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