'Where' Condition for New Record

  • Thread starter Thread starter Colin
  • Start date Start date
C

Colin

Hi,
I am making a buton so that when you click it, it
will open a form at the end to add a new record ie. a
blank record. Can anyone please tell me what the 'Where
conditon' is for this, to put in the build event thing?

Thanks

Colin
 
K, I found it eventually, but is there anyway that by
clicking a buttong, a window will pop up asking you to
type something to find in all the records for one field.

e.g. a box that pops up asking for customer name and it
then searches all the customer name fields for the
specified name? If so could someone please tell me how to
do it?

Thanks
 
Create a second form "frmFindCustomer", place a combo box on it with the
record source as the customer table, ( if the names are first and last ,
then concatenate them in the query like: Customer:Customer.FirstName & " "
Customer.LastName ). Use the Wizard to create a command button to open the
customer form and find a specific record. Now Open this form with the
original command button.
 
Hi,

I've done all you said, I only need it to search one
field - ContactName.

When I click the button, it takes me to a blank form, not
the one with that customers details.

Here is what it says in the build event bit,

___________________________________________
Option Compare Database

Private Sub Command4_Click()
On Error GoTo Err_Command4_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Customers"

stLinkCriteria = "[ContactName]=" & "'" & Me![Combo2]
& "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

End Sub

_________________________________________

Can you think of what might be wrong?

Any help is appreciated

Colin
 
Back
Top