Link to home
Start Free TrialLog in
Avatar of DB_newbie_NZ
DB_newbie_NZ

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DB_newbie_NZ
DB_newbie_NZ

ASKER

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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial