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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open new form with focus on a particular record

Status
Not open for further replies.

Mich2too

Technical User
Jan 27, 2001
103
0
0
US
Am working with some pre-created tables. What we want to do is have one form open for editting. When the customer ID is blank and is double clicked in, the customer form should open up. If there is a customer ID entered into the field, the customer form should open up with that customer information showing. I know how to use the customer ID field properties to set up the double click action, but am not sure what command to use there or the proper syntax.

I'm not familiar with Visual Basic.

Thanks in advance!!

Sue
 
You can use the OpenForm method in a If...Then...Else construct:

If IsNull(me![FormControlName]) Then
DoCmd.OpenForm "YourForm", , , ,acFormAdd"
Else
DoCmd.OpenForm "YourForm", , ,"CustomerID = 'whatever'"
End If

Hope this helps!

japapuss
 
you can do this in VBA or using a macro
here is VBA

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

docmd.openform "customer",,"customerid =" me!customerid

this will open the form to where it matches the customerid displayed on the form. If no match is found it will open to a blank form

you will need to play with the wherecondition to mmatch you filed names but this should get you started

 
Am still working on this. Haven't gotten either one to fly yet.
 
Well...since I have no real working knowledge of Visual Basic, I don't have a clue how to customize any of the portions or even what NEEDS to be customized. Have worked with macros on a limited basis and have never used the condition section.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top