Credit Card Selector Combobox

kerm3r

New member
Local time
Today, 09:48
Joined
Aug 8, 2018
Messages
3
I am fairly new to Access and creating my very first database. My database has and order form, within that order form I have a drop down to select payment method. If the payment method is credit card I need to generate a list of credit cards that are on file for that specific customer. So far no matter what I do I can't get the combobox to limit the list based on the customer id. I am trying to set the rowsource using a SQL query but it's not working. Does anyone have any suggestions or recommendations to help me populate the credit card list. See below for what I have currently.When the form opens it's asking me to enter the parameter for me.custid. I appreciate any help because this is driving me crazy. :banghead:


Private Sub CustCCComboBox_GotFocus()
Dim CustID As Long
CustID = Me.CustID

Me.CustCCComboBox.RowSource = "SELECT CustCreditCard.[Account Name], CustCreditCard.CardNumber FROM CustCreditCard WHERE (((CustCreditCard1.CustID)= me.CustId));"
Me.CustCCComboBox.Requery

End Sub
 

Attachments

  • Order Form.PNG
    Order Form.PNG
    44 KB · Views: 99
Use this:
Code:
Me.CustCCComboBox.RowSource = "SELECT CustCreditCard.[Account Name], CustCreditCard.CardNumber FROM CustCreditCard WHERE (((CustCreditCard1.CustID)= [COLOR="Red"][B]" & Me.CustId & "[/B][/COLOR]));"
 
I have been trying every combination for hours. I can clearly see my mistake now and appreciate your time. Thank you so much!!!!!!
 
You're welcome.

For WHERE clauses in SQL statements, you always need the appropriate delimiters for number/text/date datatypes as appropriate
 
Something I noted in your WHERE clause,

You are selecting from CustCreditCard but your WHERE clause references CustCreditCard1. Is this correct?
 

Users who are viewing this thread

Back
Top Bottom