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

Textbox or cbobox value = value from cbobox in previous form

Status
Not open for further replies.

Diezz

Technical User
Dec 24, 2004
61
0
0
NL
Hello,

I have a login form (frmUSER) that check up the values in the table "USERS", and each user must choose from a cbobox (cboUSERID) his name and write his password in the textbox "txtPassword". If everything it's ok they go on to frmCalls where they insert every call they have on a particular date.

The second form uses another table that also contains the User_ID (the pk from the table users).

I would like to automatically set the USER_ID value at the value the user used to log on.

Anyone has some ideeaS?
 
When you open frmCalls, you can pass the UserID via the OpenArgs parameter of the DoCmd.OpenForm method...

DoCmd.OpenForm "frmCalls", acNormal, , , , , txtUserID.Value

Then, in the Open event of frmCalls, you can access the value passed to it by referencing OpenArgs...

Msgbox OpenArgs
 
I'm not sure if i understood well.

However the login form will close so mostly openargs won't work, i think:p

I tried what you said but it gaves me an error, the object is closed or dosen`t exist
 
Sorry for spaming,

Here is my code

Private Sub cmdLogin_Click()
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "Tre sa selectezi userul tau.", vbOKOnly, "Nevoie date"
Me.cboEmployee.SetFocus
Exit Sub
End If

If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "Tre sa-ti bagi si parola bey.", vbOKOnly, "da ba date n-auzi?"
Me.txtPassword.SetFocus
Exit Sub
End If

If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then

lngMyEmpID = Me.cboEmployee.Value

DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmSplash_Screen", acNormal, , , , , cboEmployee.Value
 
since there is no answer i'll relance my case.

I've made the login form invisible and the value that i need it appears in the textbox.

So for myself, the code is 1, it appears very well in USER_ID, it saves the record, then if i want to create another record it says that USER_ID is required, and that is null so it can't save the record. However "1" is still dispayed in the USER_ID textbox.

I really want to solve this and i can't seem to find a solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top