Simple Question Could Any1 Reply To This Pls

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

. Reply (E-mail) Forward (E-mail)

Subject: Re: VC Code & Lookup
From: "paul" <[email protected]>
Sent: 1/6/2004 9:36:07 AM




Im quite confused with the concatenate? What do I need to
put in to the "fieldname". Could you help. Thankx

Paul
-----Original Message-----
DoCmd.OpenForm stDocName2,,,"[FieldName]=" & MemberVar

You need to pass the field name also and concatenate in the value of
MemberVar. The above will work if MemberVar is a number, if it is text try:

DoCmd.OpenForm stDocName2,,,"[FieldName]='" & MemberVar & "'"

This will work as long as there are no values that have apostrophes (i.e.
O'Rielly) in them. If there are, let me know and I'll change it to work with
that.

This is being passed as the WhereCondition. Note the commas as place holders
for the unused options prior to the last used one.

--
Wayne Morgan
Microsoft Access MVP


I need to, with VB code, open a form and display a
specific record.

For a test example, I am have a variable
called "MemberVar" and would like to open a form using
the variable.

I already hae the following which dont work:

DoCmd.OpenForm stDocName2, , MemberVal, MemberVal

"StDocName2" represents the name of the form I want to
open.
I put "MemberVar" in twice because I dont know if they
are or are not suppsoed to be in or either.

As you can see, Im quite stupid, and a little light on
this matter would be greatly appreciated. Thnakx

Paul


.
..
 
Paul,
Fieldname refers to the field name from the underlying
table or query of the form you are trying to open.
Membervar is the value that you want to display.
-----Original Message-----
. Reply (E-mail) Forward (E-mail)

Subject: Re: VC Code & Lookup
From: "paul" <[email protected]>
Sent: 1/6/2004 9:36:07 AM




Im quite confused with the concatenate? What do I need to
put in to the "fieldname". Could you help. Thankx

Paul
-----Original Message-----
DoCmd.OpenForm stDocName2,,,"[FieldName]=" & MemberVar

You need to pass the field name also and concatenate in the value of
MemberVar. The above will work if MemberVar is a number, if it is text try:

DoCmd.OpenForm stDocName2,,,"[FieldName]='" & MemberVar & "'"

This will work as long as there are no values that have apostrophes (i.e.
O'Rielly) in them. If there are, let me know and I'll change it to work with
that.

This is being passed as the WhereCondition. Note the commas as place holders
for the unused options prior to the last used one.

--
Wayne Morgan
Microsoft Access MVP


I need to, with VB code, open a form and display a
specific record.

For a test example, I am have a variable
called "MemberVar" and would like to open a form using
the variable.

I already hae the following which dont work:

DoCmd.OpenForm stDocName2, , MemberVal, MemberVal

"StDocName2" represents the name of the form I want to
open.
I put "MemberVar" in twice because I dont know if they
are or are not suppsoed to be in or either.

As you can see, Im quite stupid, and a little light on
this matter would be greatly appreciated. Thnakx

Paul


.
..


.
 
Back
Top