mloucel
Member
- Local time
- Today, 12:00
- Joined
- Aug 5, 2020
- Messages
- 309
Hello Everyone..
MY APOLOGIES I DON'T KNOW HOW TO POST CODE..
As you remember I am a newbie in this new world of Access, thru advise I've been learning step by step using anything from a book to youtube.
it's been only 2 months..
I am doing a very simple application.
[this is beta working towards final product]
I enter thru a login page then login opens a Patient charts form:
[chart #] [office] and all related fields to the patient. (I Will add a MENU soon after login)
The flow:
On the login I Add thru a combo box the ID of the office to a temporary variable [OfficeID=1] [OfficeName=Office01]
then I need to transfer [SOMEHOW] to the "charts form" or any form: "The OfficeID and the OfficeName.
The IDEA:
I need to display the OfficeName in a label in the Charts Form and when the NEW RECORD is saved save the ID (KEY), but if the user moves to the first record, then display the value saved in the database (is not a new record), but if it hits the NEW button then has to display again [in the label] the name of the tempvar (OfficeName) and move the OfficeID to that new record.
I have no idea how to:
Save the OfficeID and OfficeName and retrieve them in my label called [lblOfficeLocation] if this is a new record or display the saved name if the user moves to an already existing record.
This is part of the coding I have done SIMPLE and easy, any help suggestion will be greatly appreciated.
(FORGOT TO MENTION) I GET THE OFFICE ID AND OFFICE NAME FROM A DIFERENT TABLE, THERE ARE 3 TABLES, LOGIN / CHARTS / OFFICES
in my login form:
in my CHARTS form:
MY APOLOGIES I DON'T KNOW HOW TO POST CODE..
As you remember I am a newbie in this new world of Access, thru advise I've been learning step by step using anything from a book to youtube.
it's been only 2 months..
I am doing a very simple application.
[this is beta working towards final product]
I enter thru a login page then login opens a Patient charts form:
[chart #] [office] and all related fields to the patient. (I Will add a MENU soon after login)
The flow:
On the login I Add thru a combo box the ID of the office to a temporary variable [OfficeID=1] [OfficeName=Office01]
then I need to transfer [SOMEHOW] to the "charts form" or any form: "The OfficeID and the OfficeName.
The IDEA:
I need to display the OfficeName in a label in the Charts Form and when the NEW RECORD is saved save the ID (KEY), but if the user moves to the first record, then display the value saved in the database (is not a new record), but if it hits the NEW button then has to display again [in the label] the name of the tempvar (OfficeName) and move the OfficeID to that new record.
I have no idea how to:
Save the OfficeID and OfficeName and retrieve them in my label called [lblOfficeLocation] if this is a new record or display the saved name if the user moves to an already existing record.
This is part of the coding I have done SIMPLE and easy, any help suggestion will be greatly appreciated.
(FORGOT TO MENTION) I GET THE OFFICE ID AND OFFICE NAME FROM A DIFERENT TABLE, THERE ARE 3 TABLES, LOGIN / CHARTS / OFFICES
in my login form:
Code:
Private Sub cmdLogin_Click()
Dim rs As Recordset
Dim OfficeID As String
Dim OfficeName As String
Set rs = CurrentDb.OpenRecordset("tblLogin", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "UserName='" & Me.txtUserName & "'"
Me.txtUserName.SetFocus
TempVars.Add "OfficeID", cboOffice.Value
'TempVars.Add "OfficeName", OfficeLocation.Value '[This Does Not work, I rem out]
If rs.NoMatch = True Then
Me.lblIncorrectUser.Visible = True
Me.txtUserName.SetFocus
Exit Sub
End If
Me.lblIncorrectUser.Visible = False
If rs!Password <> Me.txtPassword Then
Me.lblIncorrectPassword.Visible = True
Me.txtPassword.SetFocus
Exit Sub
End If
Me.lblIncorrectPassword.Visible = False
DoCmd.OpenForm "Patient's Charts"
MsgBox TempVars!OfficeName
DoCmd.Close acForm, Me.Name
End Sub
in my CHARTS form:
Code:
If Me.NewRecord Then
Me.lblRecordCounter.Caption = "Input New Chart #"
Me.lblOfficeLocation.Caption = "New Chart for " & TempVar![OfficeName] '[This TempVar![OfficeName] does not work MUST be = to LOGIN
Else
Me.lblRecordCounter.Caption = _
" Chart # " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
Me.lblOfficeLocation.Caption = "WHAT DO I PLACE HERE?" 'I need to control this from CHARTS since the user has moved the pointer to a stored value
End If
Attachments
Last edited: