Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 52
  1. #31
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Essentially, the intID holds the records ID PK and was going to have the On Load event run the statement to search that specific record and pull the information and place certain data in certain places on the form. The statement would collect the information and I'd have like the Title column placed in lblTitle, the Assigned To column put onto a label...and so on.

  2. #32
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    strFind is not an action query so I am not sure what you are trying to accomplish with this line

    DoCmd.RunSQL strFind

    Is the from you are opening bound to a table or a query?

  3. #33
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    I was just messing with my coding to try and figure it out but obviously I couldn't =(

    The form isn't bound to anything.

    What would be the best method to have the form load with the proper information (the intID variable contains the ID of the row I need to get the information from).

  4. #34
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Still not sure why you are opening another form but

    You can bind that form to a query. You can use Where criteria in your DoCmd OpenForm line and open the form to match the ID. Then additional controls on the form that is bound could display the fields that you want.

  5. #35
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Yeah, opening new forms seem to be a pain in the ass for me. The main reason I was doing it is so that the other person is able to fill in their name, and add comments to the repair request.

    How would I use a Where criteria on openform though?

  6. #36
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    You need to typethe name of your form in place of NameOfForm. This is assuming the PK field is called ID and the first collumn of your listbox contains the value of ID. Let me know if you have trouble. Code is untested(air code)

    DoCmd.OpenForm "NameOfForm", , , "ID =" & Me.List48.Column(0)

  7. #37
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    This worked:
    Dim intID As Integer
    Dim strNew

    If Me.OpenArgs > 0 Then
    intID = Me.OpenArgs
    strNew = DLookup("[Title]", "Table1", "[ID]=" & intID)
    Label6.Caption = strNew
    End If
    Thanks for your advice, I seriously appreciate it!

  8. #38
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Glad you got it sorted.

  9. #39
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Well.. got another issue. I needed to add validation and I attempted to do so through the database (for making sure none of the fields on the frmAdd page are left blank). I used the Required mode for the fields in the database but it wouldn't allow me to change the error message that would appear if they person forgot, lets just say the "Assigned to" field. I followed some examples i found online for the On Error thing but still got an error about an issue with the OLE or ActiveX from a macro??

  10. #40
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    The frmAdd's On Load event using just the GoToRecord macro to load a "New" record. The ActiveX/OLE fires the error off when the Exit button is pushed (Exit button just uses a Macro to run a "Close Window" command.

  11. #41
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I thought the Add form was unbound? You have an OLE object you are trying to validate?

    Why don't you upload the relevant form and tables? Remove private data and zip it down

  12. #42
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Well I guess I thought it was, looks like I will have to restructure this form. Can you elaborate on that last part? I'm new to all this (like that's not damn obvious by now haha) and this is definitely a huge learning experience. My plan is going to have to be to have that Add button on the main form, open the frmAdd and then have it completely blank (like it is) and when they enter the information - it will use a SQL string to fill in a new record on the table. (that accurate?)

  13. #43
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    In post #41 I am suggesting that you upload a copy of your database so I can evaluate it. I may be able to provide you with a working example.

  14. #44
    lithium is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    72
    Okay, here it is.

  15. #45
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I deleted the relationship in the Relationship window because I could not find the field it was joimed with.

    I created a new button because... well I don't know why but the other event handlers you have do not seem to be working as expected so I just created new stuff. I also inserted an SQL string into your list box

    I bound your edit form to the table. . The code behind the button opens the form to the same record in your list box.
    Attached Files Attached Files

Page 3 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 09-17-2012, 10:36 AM
  2. Replies: 1
    Last Post: 09-12-2012, 12:44 PM
  3. Replies: 5
    Last Post: 07-26-2012, 12:59 PM
  4. Form not showing information in querry
    By srmezick in forum Forms
    Replies: 3
    Last Post: 11-15-2011, 01:39 PM
  5. Replies: 8
    Last Post: 04-21-2011, 05:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums