Solved Help please. Form close writing to dbase (1 Viewer)

GSE

New member
Local time
Today, 15:37
Joined
Nov 20, 2020
Messages
6
All,
I apologize for my ignorance but I am really struggling with my first database. Keep in mind not good with VB so i have a steep learning curve ahead.

i have a database with a query and a form that i want my users to use to search. Everything works great except when i close the form it writes to my database. Its the only obstacle that i can’t find a solution for so far. Its maddening!!!!! Please help.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:37
Joined
Oct 29, 2018
Messages
21,453
Hi. Maybe you could try making your form unbound. Or, maybe just the search controls need to be unbound.
 

GSE

New member
Local time
Today, 15:37
Joined
Nov 20, 2020
Messages
6
Hi. Maybe you could try making your form unbound. Or, maybe just the search controls need to be unbound.
I tried that but i think im missing something. How do i point the query to the unbound textbox for the search?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:37
Joined
Oct 29, 2018
Messages
21,453
I tried that but i think im missing something. How do i point the query to the unbound textbox for the search?
Hi. You should be able to use a form reference, like:

Forms!FormName.ControlName
 

GSE

New member
Local time
Today, 15:37
Joined
Nov 20, 2020
Messages
6
Hi. You should be able to use a form reference, like:

Forms!FormName.ControlName
Instead of controlname i have the name of the textbox. It works when the form and textbox are bound to the query but does not work otherwise.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:37
Joined
Oct 29, 2018
Messages
21,453
Instead of controlname i have the name of the textbox. It works when the form and textbox are bound to the query but does not work otherwise.
Hi. To make sure we're on the same page, can you post a sample copy of your db with test data?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:37
Joined
May 7, 2009
Messages
19,231
see this demo.
first open Query1 in design view. the query is an example of QBF (query by form).
noticed that the Criteria is using Form1!txtSearch textbox.
so this Query is specially useful when Form1 is open.

on Form1, type any name and press enter.
view the AfterUpdate of the txtSearch.
noticed that again i set the Form's Recordsource.
this will fetch new recordset from the query.
 

Attachments

  • Database4.accdb
    468 KB · Views: 82

Cliff67

Registered User.
Local time
Today, 13:37
Joined
Oct 16, 2018
Messages
175
The problem is you are binding your forms recordsource to the query. I normally use a list box and requery the list box for the search like the alterations to your form attached. Its simple and works to a point or searching on the first name only. Hope it helps
 

Attachments

  • Database4.accdb
    596 KB · Views: 87

Users who are viewing this thread

Top Bottom