Lookup To Autopopulate value on a form Access 2010

bkatsma

New Member
Joined
Jan 9, 2013
Messages
20
I am struggling to find a solution. I have a table that I log all my customer transactions (tbltransactions). This includes all invoices and payments, each being their own transaction record. When a customer sends me a check, they write the invoice number on it. What I am trying to do is create a lookup field on my tbltransactions form which I can enter the invoice number and it will search the transactions table and auto populate the clients name in the ClientID field on the form.

I can run the code without error. The Me.ClientID will equal the correct ClientID based of the Me.PaymentSearchBox, but ClientID field isn't showing any value in form view.

Code:
Private Sub frmtranbtnfindacct_Click()
If IsNull(Me.PaymentSearchBox) = False Then
Me.ClientID = DLookup("[ClientID]", "tbltransactions", "Invoice_no =" & Me.PaymentSearchBox)
Me.PaymentSearchBox = Null
If Me.Recordset.NoMatch Then
    MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
    Me!txtInvoiceSearchBox = Null
    End If
End If
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Last edited:
Upvote 0
I am not using a combobox since I don't want to bring up the specific record tied to that invoice, just the accountid that is associated with it. Each transaction (debit or credit) will be its own transaction. Thank you for the videos and information on lookups on tables. I may have found a solution (still working through the details...) were I created a query with the data I needed, then I Lookup to the query instead of the table.
 
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,008
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top