Open form with criteria

mchoud

Registered User.
Local time
Today, 07:39
Joined
Jun 3, 2003
Messages
25
Dear All

I have a problem with this code, when i exuting this code, the selected record is appeared with blank form.

Is there any mistake with this code ?

DoCmd.OpenForm "bincard_record_view", acNormal, , "contro_id = '" + Me.bincard_sub.Form!contro_id + "'", , acDialog, "View"

Thanks
mchoud
 
Try this:

DoCmd.OpenForm "bincard_record_view", acNormal, , "[contro_id] = """ & Me.bincard_sub.Form!contro_id & """", , acDialog, "View"
 
Mile-O-Phile said:
Try this:

DoCmd.OpenForm "bincard_record_view", acNormal, , "[contro_id] = """ & Me.bincard_sub.Form!contro_id & """", , acDialog, "View"

He mile
your code still giving the same output, here is my open argument module

Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs = "View" Then
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.AllowEdits = False
Me.com_save.Visible = False
Me.com_close.Caption = "Metu"
'WarnaAbu
End sub

When i try to modify one of it componen, for example " Metu" change with exit, the record will appeared at the form, but only one time, if i try to reopen the form the result will be blank again, unless i always change the open argument before running the form. Is there any other mistake, or should i cek the VBA reference ?

Thanks
 
Why are you opening the form in acDialog mode ??
This will cause the code to pause until the form is closed or the forms' visible property is set to False ...

Also if "contro_id" is a numeric datatype the code should be:
Code:
DoCmd.OpenForm "bincard_record_view", , , "[contro_id] = " & Me![bincard_sub].Form![contro_id]
If "contro_id" is a text datatype the code should be:
Code:
DoCmd.OpenForm "bincard_record_view", , , "[contro_id] = '" & Me![bincard_sub].Form![contro_id] & "'"
Both examples above is assuming that "bincard_sub" is the name of the "Subform Control" on the main form that displays the subform.

RDH
 
R. Hicks said:
Why are you opening the form in acDialog mode ??
This will cause the code to pause until the form is closed or the forms' visible property is set to False ...

Also if "contro_id" is a numeric datatype the code should be:
Code:
DoCmd.OpenForm "bincard_record_view", , , "[contro_id] = " & Me![bincard_sub].Form![contro_id]
If "contro_id" is a text datatype the code should be:
Code:
DoCmd.OpenForm "bincard_record_view", , , "[contro_id] = '" & Me![bincard_sub].Form![contro_id] & "'"
Both examples above is assuming that "bincard_sub" is the name of the "Subform Control" on the main form that displays the subform.

RDH
Hi Rdh
When using your code, the form appearance is appeared, but the data is not, and what do you think if i want to controlling the form property without argument at the end of module ?
Thanks
 
Hi all, thanks about all of your help, the problem has successfully solved by using acform edit, view or...

Thanks once again,

Mchoud
 

Users who are viewing this thread

Back
Top Bottom