Opening a Form of a specific ID number (1 Viewer)

BWG3

Registered User.
Local time
Today, 01:22
Joined
Sep 22, 2009
Messages
44
I have a report that prints out tasks and their respective ID number. I am attempting to make a form which will have a dialog box that will state to enter the desired task ID number. There will be a button on this form that displays "open form". I want this "open form" button to take the user directly to the form associated with the task ID number they entered for editing purposes on the task form itself. Is there any way without using a query to take this input (ID task number) and use it in the button command click code in order to just open the form of that specific task ID? Or is ther any better way to do this?

ie.
Me.taskID.value = Me.dialogbox.value

Private Sub OpenForm_Click()
On Error GoTo Err_OpenForm_Click
Dim stDocName As String

stDocName = "Form Name of Tasks"
DoCmd.OpenForm stDocName, acPreview (Is there any code I can put here to just open the form associated with the task ID number entered into the dialog box?)

Exit_OpenForm_Click:
Exit Sub
Err_OpenForm_Click:
MsgBox Err.Description
Resume Exit_OpenForm_Click

End Sub

Really appreciated all your help. Thanks.
 

BWG3

Registered User.
Local time
Today, 01:22
Joined
Sep 22, 2009
Messages
44
This is exactly what I wanted. Thank you. The thing I'm having trouble with is that it is not reading in what I have in my textbox. When I just have
DoCmd.OpenForm "Update_Form", , , "FieldName = ID"
the form "Update Form" opens up and a dialog box states "Fieldname". When I type in the Task ID number (lets say 5) into this dialog box, it gives me exactly what I want (aka filters properly). If I have 5 in my textbox (the name of my textbox is "update_dialog"), it does not work right. I tried
DoCmd.OpenForm "Update_Form", , , "FieldName = ID"
& Me.update_dialog ("update_dialog" is the name of my text box)
and it does not work right. Am I doing something wrong?

Is there any way to have that dialog box say "Enter in ID number" instead of "FieldName"?

Thanks.
 

boblarson

Smeghead
Local time
Yesterday, 22:22
Joined
Jan 12, 2001
Messages
32,059
It should actually be:

DoCmd.OpenForm "Update_Form", , , "FieldName =" & Me!ID
 

Users who are viewing this thread

Top Bottom