Refreshing a form with VBA (1 Viewer)

Winterwolf73

New member
Local time
Yesterday, 21:03
Joined
Jul 3, 2020
Messages
25
Here is a copy of what I have built so far. I have not made any changes to it though. Also as an FYI, when you open the Customer Management form, tab 3(Update Customer) disregard the cmbbox and button on the tab. I have them disabled. I have been working strictly with the subform.


Sorry for the late response. I was working in my shop.
 

Attachments

  • Jennings Wood Creations - Billing.accdb
    2.5 MB · Views: 17

moke123

AWF VIP
Local time
Yesterday, 22:03
Joined
Jan 11, 2013
Messages
2,216
You need to eliminate spaces in your object and field names.
You have criteria in the query which returns no records.

I made a few changes and commented out some code to focus just on the one issue.
 

Attachments

  • Jennings Wood Creations - Billing.accdb
    2.5 MB · Views: 19

Winterwolf73

New member
Local time
Yesterday, 21:03
Joined
Jul 3, 2020
Messages
25
Thank you Moke123. You and Bob are life savers. However, I do have just one question. I noticed you are searching by name. How can we change that to searching by account number.

I know that some of the criteria in the query does not return any results. I did that on purpose so that I could test the update function.
 

moke123

AWF VIP
Local time
Yesterday, 22:03
Joined
Jan 11, 2013
Messages
2,216
In the query for the combobox change the column for the name to the account number. Nothing else.
Actually it is searching by the primary key. The combobox only displays the name or account number.

Code:
SELECT [Customer Table].ID, [Customer Table].AccountNumber
FROM [Customer Table];
 

bob fitz

AWF VIP
Local time
Today, 03:03
Joined
May 23, 2011
Messages
4,160
Thank you Moke123. You and Bob are life savers. However, I do have just one question. I noticed you are searching by name. How can we change that to searching by account number.

I know that some of the criteria in the query does not return any results. I did that on purpose so that I could test the update function.
In the attached db, all I have done is create a form called frmCus in an attempt to illustrate the point that I was trying to make to you in an earlier post that I made. That point is, that you don't necessarily need a different form for each action (browse, add, edit) that you may want to do with the data in a table. Neither do you want to present that data in an open query. Select queries should be used to retrieve data. Forms and Reports should be used to present that data.
So, one form called frmCus. It opens at a new record. Use the navigation arrows at the bottom of the form to browse existing records. Use a combo box in the Header section to find a specific record. This one uses the A/c Number but it could be set up to search for any field of data in the table. If you wanted to complicate it a little you could even have a second combo in the header to choose what data you want to search for (First Name, Last Name, Ac Num etc) and then change the list that's shown in the second combo to those values.

In any case, IMHO there are bigger issues that I would implore you to address before going any further with the development of your db.
Read a little about db design, normalisation and naming conventions.
Then create your tables and relationships.
Forms and Reports should be amongst the last things required.
 

Attachments

  • JenningsWoodCreationsBilling Bob01.accdb
    2.5 MB · Views: 19

Users who are viewing this thread

Top Bottom