open a form in datasheet view (1 Viewer)

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
Hello,

i have the following code and i want that the form opens in datasheet view but i don't know how. can you help me please?
thank you

On Error GoTo Err_Befehl14_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Copy Of frm_logistik_zeitfehlerein"

stLinkCriteria = "[Fehlteil]=" & "'" & Me![Fehlteil] & "'"
DoCmd.OpenForm stDocName, , , acFormDS, stLinkCriteria
Exit_Befehl14_Click:
Exit Sub
Err_Befehl14_Click:
MsgBox Err.Description
Resume Exit_Befehl14_Click
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:43
Joined
Aug 30, 2003
Messages
36,125
I'm pretty sure you have the arguments in the wrong positions. Check help for the proper order.
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
how can i check with the help? i am new to ms access and vba? can you help me more please?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:43
Joined
Aug 30, 2003
Messages
36,125
After you type

DoCmd.OpenForm

is Intellisense showing you what should be in each position?
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
hello

i tried a lot and i lso wote it in this way but when i write it in this way the filter condition doesn't work. can you help me please? i don't know what to do ?
thank you

stDocName = "frm_logistik_offlinedate_detail"

stLinkCriteria = "[Fehlteil]=" & "'" & Me![Fehlteil] & "'"
DoCmd.OpenForm stDocName, acFormDS, stLinkCriteria
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
[Hello i Hve the following code and i have run time errro that
there is a syntax error(missing operation) in query expression.
can you help me please?


Me.RecordSource = "SELECT * FROM qry_Logistikreview_Zeitfehlerein WHERE qry_Logistikreview_Zeitfehlerein.Zeit Fehler Ein BETWEEN #" & Replace(Format(Me.txt_StartDate.Value, "mm/dd/YYYY"), ".", "/") & "# " & _
"AND #" & Replace(Format(DateAdd("d", 1, Me.txt_EndDate.Value), "mm/dd/YYYY"), ".", "/") & "#"



DoCmd.Requery
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:43
Joined
Aug 30, 2003
Messages
36,125
Any field with inadvisable spaces in it would have to be bracketed for starters.
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
Hello

thank you very much it works now
but i have another problem
when i run the query between two fields it doesn't show anything
but there are some data between seelcted fields

my zeit fehler ein is for example like below
2014-12-04

can you help me please?
 

JHB

Have been here a while
Local time
Today, 22:43
Joined
Jun 17, 2012
Messages
7,732
my zeit fehler ein is for example like below
2014-12-04

can you help me please?
Are you sure the field type is Date/Time, (because what you show isn't a normal date format)?
In you query you need the data in the field you are searching to be in the same format as you've in the criteria.
And you criteria shows date like mm/dd/yyyy and not yyyy-mm-dd!
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
Hello,

yes the data is as date/time field but i really don't know why it doens't work
 

JHB

Have been here a while
Local time
Today, 22:43
Joined
Jun 17, 2012
Messages
7,732
... but i really don't know why it doens't work
Did you modify your query to with the below in mind?
In you query you need the data in the field you are searching to be in the same format as you've in the criteria.
And you criteria shows date like mm/dd/yyyy and not yyyy-mm-dd!
Show some real data in a Excel sheet or in a Database.
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
hello

the attachment is the text file of my query. (some parts of that)
 

Attachments

  • qry_Logistikreview_Zeitfehlerein.txt
    10.2 KB · Views: 59

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
hello

did you see the attachment?
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
Hello

You mean you can't open it?
 

JHB

Have been here a while
Local time
Today, 22:43
Joined
Jun 17, 2012
Messages
7,732
I can open it, sorry but I can't use the data in it, it is a mess.
And I don't want the result from the query but the data the query is based on, and it a Excel sheet (so that I can import it into a database), or in a database.
 

mana

Registered User.
Local time
Today, 13:43
Joined
Nov 4, 2014
Messages
265
hello


you know i checked the data type and it is text but it is a linked table from sql server and the data type is as date in sql server but i don't know why it is linked with text data type
cany ou help me please?
 

Users who are viewing this thread

Top Bottom