Please Help.... I am having trouble with what I am sure is the very basics of access. From a command button, I want to open another form based on an ID number. I put
---------------------
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Messages"
stLinkCriteria = "[PetID]=" & "'" & Me![PetID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
--------------------------------------------
If there is a record that matches it, it will open and the Messages form will open with the PetID number in the proper field (PetID). If there is not a record already, it opens the form and it will not put the PetId in the field it should go in. (It is a totally blank record).
If I look at the properties, it has PetID = the number it should be, but I can't get it to populate the PetId field automatically. If there is not a corresponding record there already, I would like to start a new one based on that PetID that is entered automatically.
I hope this makes sense.
I know it is something really basic, but I can't figure it out.
thanks
---------------------
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Messages"
stLinkCriteria = "[PetID]=" & "'" & Me![PetID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
--------------------------------------------
If there is a record that matches it, it will open and the Messages form will open with the PetID number in the proper field (PetID). If there is not a record already, it opens the form and it will not put the PetId in the field it should go in. (It is a totally blank record).
If I look at the properties, it has PetID = the number it should be, but I can't get it to populate the PetId field automatically. If there is not a corresponding record there already, I would like to start a new one based on that PetID that is entered automatically.
I hope this makes sense.
I know it is something really basic, but I can't figure it out.
thanks