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

onopen set record straight, lol

Status
Not open for further replies.

Donkeygirl

Technical User
Nov 30, 2000
52
US
I was almost set with this onopen statement of the form, but now it is all screwed up. The idea is that I need to det two option groups on the form to null --> ME![opgrp] = Null and to fields to where I want them, so that the form will show that record on start up.
Me! [LT]= "06"
Me! [LT] = "001"
This was working for a while when there was a DoCmd.GoToRecord in the first line. Then the goto stopped working and the form could not match the code to the statment. Ahhhh. I am still trying to figure out how I can set this form on open to have those settings of null option groups and the record showing at the first one. If you can help here, that would be great.
Thanks :-0
 
Hi IsOperator,
If your form is opening and you want to get it to a new record:

Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub

If you want to open and find a specific record (in this example in the enabled orderID field record 10625):

Private Sub Form_Open(Cancel As Integer)
Me.OrderID.SetFocus
DoCmd.FindRecord 10625, acEntire, , acSearchAll, , acCurrent
End Sub

If your option groups are bound to a field they will still at this moment hold the value that is in the field. If you want to force them to null you would have to be able to edit the form and add like this:

Private Sub Form_Open(Cancel As Integer)
Me.OrderID.SetFocus
DoCmd.FindRecord 10625, acEntire, , acSearchAll, , acCurrent
Me.ShipVia = Null
End Sub

Where "ShipVia" is the name of an option group.
You should be able to apply these examples to go to the first record, then set your option groups to null.

Gord
ghubbell@total.net
 
Thank you so much. I printed out the post you replied with. It will help me a lot. I apologize for not replying sooner. I had gotten db overload, and needed a break. Now I am picking it back up again. Thank you again.
IS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top