DoCmd.OpenForm issues (1 Viewer)

Manos39

Registered User.
Local time
Today, 07:12
Joined
Feb 14, 2011
Messages
248
Hi all,
Is following wrong? a search command opens Fr_PromStoixeia and access pops up Enter parameter Value ? "Tbl_Promitheytes;promitheytesID"



Code:
DoCmd.OpenForm "Fr_PromStoixeia", , , _
        "[Tbl_Promitheytes;promitheytesID]=" & "'" & Me.lstSearch.Column(0) & "'"
 

Eugene-LS

Registered User.
Local time
Today, 17:12
Joined
Dec 7, 2018
Messages
481
Enter parameter Value ? "Tbl_Promitheytes;promitheytesID"
Try write as below:
Code:
Dim sVal As String
    sVal = "[promitheytesID]='" & Me.lstSearch.Column(0) & "'"
    DoCmd.OpenForm "Fr_PromStoixeia", , , sVal
 

Manos39

Registered User.
Local time
Today, 07:12
Joined
Feb 14, 2011
Messages
248
Try write as below:
Code:
Dim sVal As String
    sVal = "[promitheytesID]='" & Me.lstSearch.Column(0) & "'"
    DoCmd.OpenForm "Fr_PromStoixeia", , , sVal
Hello and thank you
There's error and Vb shows an arrow
in:
DoCmd.OpenForm "Fr_PromStoixeia", , , sVal
 

Eugene-LS

Registered User.
Local time
Today, 17:12
Joined
Dec 7, 2018
Messages
481
There's error and Vb shows an arrow
Ok! Try please that way:
Code:
DoCmd.OpenForm "Fr_PromStoixeia", , , "promitheytesID = '" & Me.lstSearch.Column(0) & "'"
 

Eugene-LS

Registered User.
Local time
Today, 17:12
Joined
Dec 7, 2018
Messages
481
VB runtime error 3464
Access "Runtime error 3464" = Data type mismatch in criteria expression
Are you sure that your [promitheytesID] field data type is Text ?
May be it's data type is number ???
if so , you don't need to frame the condition in single quotes .

Code:
DoCmd.OpenForm "Fr_PromStoixeia", , , "promitheytesID = " & Me.lstSearch.Column(0)
 

Manos39

Registered User.
Local time
Today, 07:12
Joined
Feb 14, 2011
Messages
248
Access "Runtime error 3464" = Data type mismatch in criteria expression
Are you sure that your [promitheytesID] field data type is Text ?
May be it's data type is number ???
if so , you don't need to frame the condition in single quotes .

Code:
DoCmd.OpenForm "Fr_PromStoixeia", , , "promitheytesID = " & Me.lstSearch.Column(0)
Thank you for your replies actually it is an autonumbered field!
Where i have seen the code it indeed was referring to a text box... Thats getting me closer!
 

Manos39

Registered User.
Local time
Today, 07:12
Joined
Feb 14, 2011
Messages
248
Thank you for your replies actually it is an autonumbered field!
Where i have seen the code it indeed was referring to a text box... Thats getting me closer!
Thank you very much ! it is solved now by your suggestion!
Code:
DoCmd.OpenForm "Fr_PromStoixeia", , , _
     "promitheytesID = " & Me.lstSearch.Column(0)
 

Eugene-LS

Registered User.
Local time
Today, 17:12
Joined
Dec 7, 2018
Messages
481
Thank you very much ! it is solved now by your suggestion!
You are welcome!
But I think that "more beautiful" is still so:
Code:
Dim sVal As String 'String Variable

'Where Condition (like in an query after WHERE statement) :
    sVal = "promitheytesID = " & Me.lstSearch.Column(0)
    DoCmd.OpenForm "Fr_PromStoixeia", , , sVal
 

Manos39

Registered User.
Local time
Today, 07:12
Joined
Feb 14, 2011
Messages
248
Also another problem is :
When form opens it is run behind switchboard
code used
Code:
DoCmd.OpenForm "Fr_PromStoixeia", , , _
     "promitheytesID = " & Me.lstSearch.Column(0)
do i need setfocus and how do i put it
 

Eugene-LS

Registered User.
Local time
Today, 17:12
Joined
Dec 7, 2018
Messages
481
actually it is a dynamic form
I don't know about "dynamic" forms, unfortunately.
Try write like below:
Code:
'Me.Visible = False
    'or
    DoCmd.Close acForm, Me.Name
   
    DoCmd.OpenForm "Fr_PromStoixeia", , , _
        "promitheytesID = " & Me.lstSearch.Column(0)

On close of form "Fr_PromStoixeia" write code:
Code:
DoCmd.OpenForm "switchboard"
 

Manos39

Registered User.
Local time
Today, 07:12
Joined
Feb 14, 2011
Messages
248
actually it is a dynamic form

I don't know about "dynamic" forms, unfortunately.
Try writing like this:
Code:
'Me.Visible = False
    'or
    DoCmd.Close acForm, Me.Name
   
    DoCmd.OpenForm "Fr_PromStoixeia", , , _
        "promitheytesID = " & Me.lstSearch.Column(0)

On close of form "Fr_PromStoixeia" write code:
Code:
DoCmd.OpenForm "switchboard"
thank you it works!
 

Users who are viewing this thread

Top Bottom