Button done with wizard seems to default to form view when I need datasheet view ... ?

  • Thread starter StargateFanFromWork
  • Start date
S

StargateFanFromWork

I used a button to create a navigational button between two forms. When I
open up the target form manually, I get the datasheet view which most
resembles the original tables. It's neat because its built on a query, of
course, that is specific for our needs. But when I built a button just now
to go to this form, it gets opened instead in form view which is no good for
our purposes. What can I do to change this? I have the vb code that was
generated for this button but can't see what determines which view it's
opened in:



Private Sub OpenVoiceMailForm_Click()
On Error GoTo Err_OpenVoiceMailForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EmployeeAndVoiceMail"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenVoiceMailForm_Click:
Exit Sub

Err_OpenVoiceMailForm_Click:
MsgBox Err.Description
Resume Exit_OpenVoiceMailForm_Click

End Sub




Thanks so much! Cheers! :blush:D
 
F

fredg

I used a button to create a navigational button between two forms. When I
open up the target form manually, I get the datasheet view which most
resembles the original tables. It's neat because its built on a query, of
course, that is specific for our needs. But when I built a button just now
to go to this form, it gets opened instead in form view which is no good for
our purposes. What can I do to change this? I have the vb code that was
generated for this button but can't see what determines which view it's
opened in:

Private Sub OpenVoiceMailForm_Click()
On Error GoTo Err_OpenVoiceMailForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EmployeeAndVoiceMail"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenVoiceMailForm_Click:
Exit Sub

Err_OpenVoiceMailForm_Click:
MsgBox Err.Description
Resume Exit_OpenVoiceMailForm_Click

End Sub

Thanks so much! Cheers! :blush:D

Regardless of a Form's Default View setting, if you open it from and
event on another form you must specify Datasheet View.

DoCmd.OpenForm stDocName, acFormDS , , stLinkCriteria
 
S

StargateFanFromWork

fredg said:
Regardless of a Form's Default View setting, if you open it from and
event on another form you must specify Datasheet View.

DoCmd.OpenForm stDocName, acFormDS , , stLinkCriteria

That is perfect, thank you! Is that called a delimiter, I believe? Anyway,
adding the "acFormDS" where there was nothing before between the commas, did
the trick.

You're a life-saver. Thank you! :blush:D
 
J

John Spencer

No, a delimiter is something that sets the boundary (or limit) between
items.

What you are referring to in this context is called an argument.

The commas between the arguments are delimiters in the statement below.
DoCmd.OpenForm stDocName, acFormDS , , stLinkCriteria

The arguments are stDocname, acformDs and stLinkCriteria.
 
S

StargateFanFromWork

John Spencer said:
No, a delimiter is something that sets the boundary (or limit) between
items.

What you are referring to in this context is called an argument.

The commas between the arguments are delimiters in the statement below.
DoCmd.OpenForm stDocName, acFormDS , , stLinkCriteria

The arguments are stDocname, acformDs and stLinkCriteria.

I knew it was something along those lines <lol>. Thanks for setting me
straight. (I have an atrocious memory, too, you see.)

Thanks. :blush:D
 

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