If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Filter By Form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-09-02, 11:06
mhagan mhagan is offline
Registered User
 
Join Date: Jul 2002
Posts: 6
Question Filter By Form

I have an Access form that I want to distribute to users who do not have Access. I do not have Microsoft Office Developer or this would be easy.

The form allows the user to filter records based on date of birth, soc sec nbr or any other field on the form. I tried creating a data access page, but I can't filter by form on the data access page.

I also tried creating a form in VB6 using the Access database. I was able to create the form, but I don't know much about coding, and I was not able to replicate the filter by form feature? Anyone with any ideas? I could really use some help!!!!!!!!!!!!!!

Thanks!
Reply With Quote
  #2 (permalink)  
Old 07-09-02, 21:11
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Using vb you can create a recordset object and use a property called filter or a method called find. If you need help starting it, please respond.

Good luck.
Reply With Quote
  #3 (permalink)  
Old 07-10-02, 08:22
mhagan mhagan is offline
Registered User
 
Join Date: Jul 2002
Posts: 6
Thank you for your response! I tried creating a text box and a command button. This is the code that I entered:

Private Sub Command1_Click()
Dim adoPrimaryRS As Recordset
Recordset = "Select [Pat Birthdate] FROM tblchartlocator WHERE [Pat Birthdate] Like '%" & Text1 & "%'"
adoPrimaryRS.Refresh
End Sub

When I try to run the subprocedure, I get an error that says:

"Compile error: Member or data member not found."

This is the part that the debugger hilites:

Private Sub Command1_Click()
Dim adoPrimaryRS As Recordset
Recordset = "Select [Pat Birthdate] FROM tblchartlocator WHERE [Pat Birthdate] Like '%" & Text1 & "%'"
adoPrimaryRS.Refresh
End Sub

Thanks again, for any help that you can give me! If you'd like to e-mail me instead of going through the message board, do so at mhagan@boice-willis.com.
Reply With Quote
  #4 (permalink)  
Old 07-10-02, 10:25
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
I am not sure if you are using the recordset object or the ado data control. Try the following - select project-references-ms ado objects 2.x and look at the following code - it is from a ms help file - Your strCnn will be different since you are using ms access:

Dim rstPublishers As ADODB.Recordset
Dim rstPublishersCountry As ADODB.Recordset
Dim strCnn As String
Dim intPublisherCount As Integer
Dim strCountry As String
Dim strMessage As String

' Open recordset with data from Publishers table.
strCnn = "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
Set rstPublishers = New ADODB.Recordset
rstPublishers.CursorType = adOpenStatic
rstPublishers.Open "publishers", strCnn, , , adCmdTable

' Populate the Recordset.
intPublisherCount = rstPublishers.RecordCount

' Get user input.
strCountry = Trim(InputBox( _
"Enter a country to filter on:"))

If strCountry <> "" Then
' Open a filtered Recordset object.
Set rstPublishersCountry = _
FilterField(rstPublishers, "Country", strCountry)

If rstPublishersCountry.RecordCount = 0 Then
MsgBox "No publishers from that country."
Else
' Print number of records for the original
' Recordset object and the filtered Recordset
' object.
strMessage = "Orders in original recordset: " & _
vbCr & intPublisherCount & vbCr & _
"Orders in filtered recordset (Country = '" & _
strCountry & "'): " & vbCr & _
rstPublishersCountry.RecordCount
MsgBox strMessage
End If
rstPublishersCountry.Close

End If

Respond if you need additional help.
Reply With Quote
  #5 (permalink)  
Old 07-10-02, 11:41
mhagan mhagan is offline
Registered User
 
Join Date: Jul 2002
Posts: 6
THANK YOU! I WILL TRY YOUR SUGGESTIONS!!!!!!!!!!!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On