Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need some tips on how to bind a form to a hyperlink in a textbox 1

Status
Not open for further replies.

miscluce

MIS
Oct 4, 2007
149
US
I am trying to code a program so that when a user clicks on a hyperlink in a textbox or cell from one form, another form pops open with that current records information populated in it that the user clicked.

What would be easier macros, vba? What would be easier vb or macros)? I am probably more familiar with vba.

I now I need to do something with a condition or where clause but I am fairly new in using macros which is a little confusing to me. can someone lead me in the right direction on how to do this or know of any websites with an example?

thanks in advance
 
Is there a reason why you do not wish to use OpenForm in either the Click or DblClick events?
 
do you mean this?

docmd.OpenForm

I have no reason. I know how to open the form. I just need to figure out how to populate the texboxes with the right data that was selected.
 
The full method is:

[tt]DoCmd.OpenForm formname[, view][, filtername][, wherecondition][, datamode][, windowmode][, openargs][/tt]

As you can see, there is a Where condition, which can be used to open a form to a selected record or set of records.

 
It says I have a syntax error missing operator in query expression 'NAME = Antonio'


DoCmd.OpenForm "Contact Details", WhereCondition:="NAME=" & Me.txtNAme

 
Name is a reserved word and should never be used when naming fields.

DoCmd.OpenForm "Contact Details", WhereCondition:="[NAME]='" & Me.txtNAme & "'"

You need single quotes when referring to a text field. There is an additional complication if the text field could contain a single quote, O'Connor, for example. The way around is the Replace function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top