TC,
I will like to know two things from you, that will actually make my burden
less.
(1) How will I make this form to open without any record, that is to open
blank of records in the textbox and the combobox. (2) How will this form on
enter populate another form with it's result, so that the user can make
changes, or update based on whatever he wants to do?
I do appreciate all these contributions I know someone will certianly help
me out.
Though, right now I have this code below which can only search with
Filenumber. I have tried to use it with the Municipality and other parameters
in the table field and it is not working what am I doing wrong and how can I
correct it.
Private Sub SEARCH_RECORD_Click()
On Error GoTo Err_SEARCH_RECORD_Click
This section is working great, finding any file number entered into the text
box and populating it to the Edit Form.
Dim stDocName As String
Dim stLinkCriteria As String
'Check to make sure a correct File Number was entered
Me.FILENO.SetFocus
If Me.FILENO.Text = "" Then
MsgBox "PLEASE ENTER A VALID FILENO", vbExclamation, "ACRP"
Exit Sub
End If
'Select records from Edit Record Form that match the selection criteria of
'a chosen File Number
Me.FILENO.SetFocus
If Me.FILENO.Text = "" Then
stLinkCriteria = "[FILENO] Like '*" & Me.STREET & "*' "
ElseIf Me.FILENO.Text <> "" Then
stLinkCriteria = "[FILENO] Like '*" & Me.STREET & "*' and [FILENO] =
'" & Me.FILENO & "' "
End If
This section of the code is not working! So what is it that I'm doing
wrongly. Because I have up to 50 parameters and objects that I have to work
with. Right now it's only one working.
'Check to make sure a correct Municipality was entered
'Me.MUNICIPALITY.SetFocus
'If Me.MUNICIPALITY.Text = "" Then
' MsgBox "PLEASE ENTER A VALID Municiplaity", vbExclamation, "ACRP"
' Exit Sub
'End If
'Select records from Edit Record Form that match the selection criteria of
'a Municipal
' Me.MUNICIPALITY.SetFocus
' If Me.MUNICIPALITY.Text = "" Then
' stLinkCriteria = "[MUNICIPALITY] Like '*" & Me.STREET & "*' "
'ElseIf Me.MUNICIPALITY.Text <> "" Then
' stLinkCriteria = "[MUNICIPALITY] Like '*" & Me.STREET & "*' and
[MUNICIPLAITY] = '" & Me.MUNICIPALITY & "' "
'End If
stDocName = "EDITRECORDFORM"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_SEARCH_RECORD_Click:
Exit Sub
Err_SEARCH_RECORD_Click:
MsgBox Err.Description
Resume Exit_SEARCH_RECORD_Click
End Sub
Zetony said:
TC said:
Why don't you just use a normal form that is bound to the table? Then
Access /automatically/ lets you search the table by any value, or
combination of values. You do not need to write any code, at all.
HTH,
TC [MVP Access]