Hi formulaic,
This is pretty basic, stripped down code - but I hope it helps.
What this is doing is getting the AccountOwner and AccountBalance from your Account Table - based on the Account Number that is entered on your Form.
This code should be in the Command Button.
Your Form should have a Text Box Named AccountNumber [no space].
I used the MsgBoxes to show me what I was getting - you can comment them out.
Code:
Private Sub Command9_Click()
Dim strSQL
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim AccountHolder, strSQL As String
Dim AccountBalance As Double
Set db = CurrentDb
strSQL = "Select * From [Account Table] Where [Account Number] = " & Me.[AccountNumber]
MsgBox strSQL
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
With rs
AccountHolder = rs![Account Owner]
AccountBalance = rs![Account Balance]
MsgBox "AccountHolder: " & AccountHolder
MsgBox "AccountBalance: " & AccountBalance
End With
End Sub
Once you are satisfied that this is working the way you expect, you can add this right after 'End With' to put the AccountHolder and AccountBalance into the fields in your Form - like this:
{You will need Text Boxes named 'Account Owner at Time of Application' and 'Account Balance at Time of Application'.}
Code:
Me.[Account Owner at Time of Application] = AccountHolder
Me.[Account Balance at Time of Application] = AccountBalance
Let me know if this helps!