Why Is My Report Updating A Table (1 Viewer)

lhooker

Registered User.
Local time
Today, 13:07
Joined
Dec 30, 2005
Messages
399
Can someone tell me why the 'Name' field in the 'Gift_Totals' table is being updated with the last value of the "Recreate Totals" report that was displayed ? Only the first record for the 'Name' field in the 'Gift_Totals' table is affected. The name is selected from the 'Listbox'. Below the 'DoCmd' commands used.

DoCmd.OpenReport "Re-Create Report Gifts", acViewPreview
DoCmd.Close acForm, "Recreate Totals", acSaveNo

A 'Test' database is attached.:banghead:
 

Attachments

  • Test.mdb
    1.4 MB · Views: 60

MarkK

bit cruncher
Local time
Today, 10:07
Joined
Mar 17, 2004
Messages
8,181
Your 'Recreate Totals' form is bound to a query 'Query_Recreate_Name', and the ListBox on that form is bound to the Name field of that query. As a result, when you make a selection in the listbox, you are editing the value in that field.

But for what that form seems to do, there is no need for it to be bound, and there is no need for ListBox to be bound either. Delete the RecordSource property of the form, and delete the ControlSource property of the ListBox control, and it will work just the same, and the Listbox will not be able to edit data.

hth
Mark
 

lhooker

Registered User.
Local time
Today, 13:07
Joined
Dec 30, 2005
Messages
399
Mark,

I deleted the RecordSource property of the form, and delete the ControlSource property of the ListBox control, but now no data on the report. I don't understand why Query_Recreate_Survey is not receiving the Name. The query criteria is [Forms]![Recreate Totals]![Name]. Any idea why ?
 

MarkK

bit cruncher
Local time
Today, 10:07
Joined
Mar 17, 2004
Messages
8,181
Did you select something in the listbox on the form? You still need to make a selection in the listbox, and there won't be default selection now that there is no underlying row.
hth
Mark
 

JHB

Have been here a while
Local time
Today, 19:07
Joined
Jun 17, 2012
Messages
7,732
You've a wrong reference in the query "Query_Recreate_Survey", you've "[Forms]![Recreate Totals]![Name]" it need to be "[Forms]![Recreate Totals]!
[ListBoxName]".
Database attached.
 

Attachments

  • TestIt.mdb
    476 KB · Views: 61

lhooker

Registered User.
Local time
Today, 13:07
Joined
Dec 30, 2005
Messages
399
JHB,

Thanks ! ! ! That worked. Also, Thanks MarkK ! ! !
 

Users who are viewing this thread

Top Bottom