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 form with DoCmd? 1

Status
Not open for further replies.

Asspin

Technical User
Jan 17, 2005
155
0
0
US
Ok so I am trying to open a form with another form and have it pull the record that corresponds to the date selected on the first form. I am trying to use the following, but it is just opening a blank/new record on the form.

Code:
Private Sub cmdOpen_Click()
    DoCmd.OpenForm "fData", , , "[dDate]=" & Me!txtDate
End Sub

I would also like to figure out how to have it open a blank record if the record doesn't exist in the table. Any help is appreciated!

Dan
 
How are ya Asspin . . .

Perhaps the follwing will do:
Code:
[blue]DoCmd.OpenForm "fData", , , "[dDate]=#" & Me!txtDate & "#"[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hmm ok, maybe I set this form up wrong...

This seems to work for the main form, but I have subforms and the data isn't recording right, it is just saving to the first record in the database.

Any ideas?

Dan
 
Asspin . . .

I can think of a great many things as far as you last post is concerned [blue]9 Jun 09 12:15[/blue]. Youll have to be more specific about this! . . . and if you don't mind ... start a new thread so [blue]all[/blue] in the forums here may bebefit!

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top