fieldName property

  • Thread starter Thread starter azu_daioh
  • Start date Start date
A

azu_daioh

In VB, how do i open a form based on the field name?

In [DataEntry] form, i would like to be able to double click on the
fields to open the [Field Description]

For example if I double-click on the form name [license#], i would
like th open the form [Field Description] and go to the record for
[license#]


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Field Description"
stLinkCriteria = Me!FieldName

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


I dont know how to use the fieldName property.
Thank you,


Sharon
 
In VB, how do i open a form based on the field name?

In [DataEntry] form, i would like to be able to double click on the
fields to open the [Field Description]

For example if I double-click on the form name [license#], i would
like th open the form [Field Description] and go to the record for
[license#]


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Field Description"
stLinkCriteria = Me!FieldName

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


I dont know how to use the fieldName property.

The stLinkCriteria argument needs to be a text string which is a valid SQL
WHERE clause, such as

[License#] = 'AA123123123B'

If Me!FieldName refers to a textbox named FieldName (yuck!!) on the Form which
contains a valid License value, and if License is a Text field, then try:

stLinkCriteria = "[License#] = '" & Me!FieldName & "'"

DoCMd.OpenForm stDocName, , , stLinkCriteria

John W. Vinson [MVP]
 
Thanks. But I guess I didnt explain properly.

I have two forms [Field Description] and [Data Entry]

In [Field Description], i have a field named [fldName] where records
include "license#, fName, lName"
In [Data Entry], i have fields named [license#], [fName], [lName]

What I want to accomplish is when a user double clicks on the textbox
[Data Entry].[license#] I want it to open the form [Field Description]
with focus on [fldName] = license#

The [Field Description] serves as a help tool to describe the field
and what info should be entered in the field.


Thanks,

Sharon
 
I figured it out.

Private Sub License__DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Field Description"
stLinkCriteria = "[fldName] = '" & Me.ActiveControl.Name & "' "
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub


Thank you.
 
But now i want to convert it to:

Public Sub openDescription()



How do I call this? I tried typing "openDescription" in the
OnDoubleClick property but that didnt work. I've never tried
something like this before.
 
:)

i figued this one out too. Thank you.

Well, that was easy... <g>

Sometimes just composing the question suggests the route to the answer. Glad
that was the case for you!

John W. Vinson [MVP]
 

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

Similar Threads


Back
Top