Search results will not open in a form

M

Marie203

I am having a problem getting my Access database search results to open in a
form. When I first open the database, a switchboard opens that will allow
the user to add an entry to the database, search the database, and exit the
database. The search button opens a search form that has three buttons:
Clear field(s) (Command15), Search DB (Command16), & Close Search Form
(Command17). The Clear Field(s) button and the Close Search Form button work,
but the Search DB button doesn’t work like I want it to. It performs the
keyword search correctly, but the results show in a datasheet. I want each
record to show in a separate form after the search rather than a datasheet
because of the amount and kind of information. I am not really familiar with
writing code, but I have tried to use examples that I have found on the
Internet. I have spent many hours trying to figure this out, but I can’t. I
know this command is a problem: DoCmd.OpenQuery "helpquery", acViewNormal
but I don't know what it should be. Please help. The form that has all of
the database records is called HELP_FRM. The code is below.

Option Compare Database

Private Sub Label9_Click()
Me.qtype1.Value = ""
Me.qtopic1.Value = ""
Me.qdescrip1.Value = ""
End Sub
Private Sub Command12_Click()
On Error GoTo Err_Command12_Click


Screen.PreviousControl.SetFocus
DoCmd.FindNext

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub
Private Sub CParam_Click()
On Error GoTo Err_CParam_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_CParam_Click:
Exit Sub

Err_CParam_Click:
MsgBox Err.Description
Resume Exit_CParam_Click

End Sub
Private Sub RQuery_Click()
On Error GoTo Err_RQuery_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_RQuery_Click:
Exit Sub

Err_RQuery_Click:
MsgBox Err.Description
Resume Exit_RQuery_Click

End Sub

Private Sub Command15_Click()

Me.qtype1.Value = ""
Me.qtopic1.Value = ""
Me.qdescrip1.Value = ""

End Sub

Private Sub Command16_Click()
DoCmd.OpenQuery "helpquery", acViewNormal
End Sub
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click


DoCmd.Close

Exit_Command17_Click:
Exit Sub

Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click

End Sub
 
S

Steve Sanford

Hi Marie,

Just so we're talking apples to apples:

Tables have data (records).
Queries are "virtual" tables (my defination)
Forms/Reports display records.

Tables *always* open in datasheet format. They cannot be opened in any other
format.

Forms can be opened in datasheet view, single form view (one record) or
continous forms view (multiple records).

So, to see the records "Prettied up", you use a form.

1) Create a new form.
2) Make the FORM header and footer visible (Menu bar - VIEW/Form
Header/Footer)
3) Open the form properties dialog box.
4) On the "FORMAT" tab, set the "Default View" property to "Single Form" or
"Continous Forms" (try one then the other)
5) On the "DATA" tab, set the "Record Source" property to your query
"helpquery".
6) Add the fields to the form and do whatever formatting/ color changes you
want.
7) Don't forget a form CLOSE button :)

8) Save the form .... lets call it "frmRecordsFound".

9)Change the code for the button Search DB (Command16) to:

'-------code begin -------------
Private Sub Command16_Click()
'Search DB

DoCmd.OpenForm "frmRecordsFound"

End Sub
'-------code end ----------------



HTH
 
M

Marie203 via AccessMonster.com

Steve,

Thanks for your help. I was able to use the information and make the changes
in less than 10 minutes. I had spent many hours trying to make it work.
Again, thanks and I really appreciate your time and help.

Marie



Steve said:
Hi Marie,

Just so we're talking apples to apples:

Tables have data (records).
Queries are "virtual" tables (my defination)
Forms/Reports display records.

Tables *always* open in datasheet format. They cannot be opened in any other
format.

Forms can be opened in datasheet view, single form view (one record) or
continous forms view (multiple records).

So, to see the records "Prettied up", you use a form.

1) Create a new form.
2) Make the FORM header and footer visible (Menu bar - VIEW/Form
Header/Footer)
3) Open the form properties dialog box.
4) On the "FORMAT" tab, set the "Default View" property to "Single Form" or
"Continous Forms" (try one then the other)
5) On the "DATA" tab, set the "Record Source" property to your query
"helpquery".
6) Add the fields to the form and do whatever formatting/ color changes you
want.
7) Don't forget a form CLOSE button :)

8) Save the form .... lets call it "frmRecordsFound".

9)Change the code for the button Search DB (Command16) to:

'-------code begin -------------
Private Sub Command16_Click()
'Search DB

DoCmd.OpenForm "frmRecordsFound"

End Sub
'-------code end ----------------

HTH
I am having a problem getting my Access database search results to open in a
form. When I first open the database, a switchboard opens that will allow
[quoted text clipped - 84 lines]
 
S

Steve Sanford

You are very welcome. Sometimes it just takes a nudge to get moving again.
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Marie203 via AccessMonster.com said:
Steve,

Thanks for your help. I was able to use the information and make the changes
in less than 10 minutes. I had spent many hours trying to make it work.
Again, thanks and I really appreciate your time and help.

Marie



Steve said:
Hi Marie,

Just so we're talking apples to apples:

Tables have data (records).
Queries are "virtual" tables (my defination)
Forms/Reports display records.

Tables *always* open in datasheet format. They cannot be opened in any other
format.

Forms can be opened in datasheet view, single form view (one record) or
continous forms view (multiple records).

So, to see the records "Prettied up", you use a form.

1) Create a new form.
2) Make the FORM header and footer visible (Menu bar - VIEW/Form
Header/Footer)
3) Open the form properties dialog box.
4) On the "FORMAT" tab, set the "Default View" property to "Single Form" or
"Continous Forms" (try one then the other)
5) On the "DATA" tab, set the "Record Source" property to your query
"helpquery".
6) Add the fields to the form and do whatever formatting/ color changes you
want.
7) Don't forget a form CLOSE button :)

8) Save the form .... lets call it "frmRecordsFound".

9)Change the code for the button Search DB (Command16) to:

'-------code begin -------------
Private Sub Command16_Click()
'Search DB

DoCmd.OpenForm "frmRecordsFound"

End Sub
'-------code end ----------------

HTH
I am having a problem getting my Access database search results to open in a
form. When I first open the database, a switchboard opens that will allow
[quoted text clipped - 84 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top