423,336 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,336 IT Pros & Developers. It's quick & easy.

requery pop up form with parameter

P: 25
Hi,
on a form I have 2 buttons, they both open the same popup form.

button a:
DoCmd.OpenForm "frmCustomers", acNormal, , , acFormAdd, acDialog

button b:
DoCmd.OpenForm "frmCustomers", acNormal, , strWHERE, acFormEdit, acDialog

the query behind the pop up is (shortened):
SELECT tblCustomers.CustomerID, tblCustomers.FirstName, tblCustomers.LastName, [FirstName] & " " & [LastName] AS FullName, tblCustomers.HomePhone, tblCustomers.MobilePhone, tblCustomers.FaxNumber,
FROM tblCustomers;

Regardless which button was pressed to open the popup form, i need to be able to have the option to select a customer in a combobox on the popup form (contains list of customers)and have 1 record in the popup form recordset (using the combobox afterupdate event). I was looking as querydef but can't seem to work out a simple solution.

Thanks
Nov 6 '17 #1
Share this Question
Share on Google+
1 Reply


twinnyfo
Expert Mod 2.5K+
P: 2,537
Neruda,

Your strWHERE variable should be a Filter, not a Query. What is the RecordSource of the popup form? Looks like it is (or should be) tblCustomers?

Also, if the Popup is supposed to produce one record for one Customer, based on the record selected from the Combo Box, then your strWHERE variable would look something like this:

Expand|Select|Wrap|Line Numbers
  1. strWHERE = "CustomerID = " & Me.cboComboBoxName
Hope this hepps!
Jan 2 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.